daserraf Posted August 24, 2007 Share Posted August 24, 2007 (edited) Hey Guys, Hope you can help. I am creating checkboxes dynamicly but then I need to check to see which boxes are checked This is how I create the boxes (Hope this is right!) GUICreate("Select Slip",450,500,100,100) $objConn = ObjCreate("ADODB.Connection") $objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;") $rsCustomers = $objConn.Execute("Select * from data WHERE status='Open' ORDER BY depot") $Label_Height = 10 $Check_Box_Number = 0 With $rsCustomers While Not .EOF $Label_Value = $rsCustomers.Fields("depot").value $Check_Box[$Check_Box_Number]= GUICtrlCreateCheckbox($Label_Value,10,$Label_Height,200) $Label_Height = $Label_Height + 25 $Check_Box_Number = $Check_Box_Number + 1 .MoveNext WEnd .Close EndWith $objConn.Close Edited August 24, 2007 by daserraf Link to comment Share on other sites More sharing options...
daserraf Posted August 24, 2007 Author Share Posted August 24, 2007 (edited) Hey Guys, Hope you can help. I am creating checkboxes dynamicly but then I need to check to see which boxes are checked This is how I create the boxes (Hope this is right!) GUICreate("Select Slip",450,500,100,100) $objConn = ObjCreate("ADODB.Connection") $objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;") $rsCustomers = $objConn.Execute("Select * from data WHERE status='Open' ORDER BY depot") $Label_Height = 10 $Check_Box_Number = 0 With $rsCustomers While Not .EOF $Label_Value = $rsCustomers.Fields("depot").value $Check_Box[$Check_Box_Number]= GUICtrlCreateCheckbox($Label_Value,10,$Label_Height,200) $Label_Height = $Label_Height + 25 $Check_Box_Number = $Check_Box_Number + 1 .MoveNext WEnd .Close EndWith $objConn.CloseThe problem I have is how to name those dynamic boxes so that I can access them later? so that I can do the following GUICtrlSetState($first_checkbox, $GUI_CHECKED) Thanx for the help Edited August 24, 2007 by daserraf Link to comment Share on other sites More sharing options...
Monamo Posted August 24, 2007 Share Posted August 24, 2007 Hey Guys, Hope you can help. I am creating checkboxes dynamicly but then I need to check to see which boxes are checked This is how I create the boxes (Hope this is right!) GUICreate("Select Slip",450,500,100,100) $objConn = ObjCreate("ADODB.Connection") $objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=data.mdb;") $rsCustomers = $objConn.Execute("Select * from data WHERE status='Open' ORDER BY depot") $Label_Height = 10 $Check_Box_Number = 0 With $rsCustomers While Not .EOF $Label_Value = $rsCustomers.Fields("depot").value $Check_Box[$Check_Box_Number]= GUICtrlCreateCheckbox($Label_Value,10,$Label_Height,200) $Label_Height = $Label_Height + 25 $Check_Box_Number = $Check_Box_Number + 1 .MoveNext WEnd .Close EndWith $objConn.Close Try something like the following, then use GUICtrlSetState() to check/uncheck, or GUICtrlGetState() to read the items in the array ($CheckboxList). Dim $CheckboxList[1] = ["0"] $i=UBound($CheckboxList) While Not .EOF $Label_Value = $rsCustomers.Fields ("depot").value ReDim $CheckboxList[UBound($CheckboxList)+1] $CheckboxList[0]=$CheckboxList[0]+1 $Check_Box[$CheckboxList[0]] = GUICtrlCreateCheckbox($Label_Value, 10, $Label_Height, 200) $Label_Height = $Label_Height + 25 .MoveNext WEnd - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now