I'm trying to create a simple shopping cart, so when the multiple checkboxes on the UI are checked the objects are added to the database. My question is how would I handle checking to see which checkboxes are checked from the multiple checkboxes and what is the best method of saving the objects to storage.
Shopping Cart checkboxes
Collapse
X
-
I hope you are using vb.net. Here is something you can try using.Originally posted by wboswI'm trying to create a simple shopping cart, so when the multiple checkboxes on the UI are checked the objects are added to the database. My question is how would I handle checking to see which checkboxes are checked from the multiple checkboxes and what is the best method of saving the objects to storage.
[CODE=vbnet]Dim ctrlCol As ControlCollecti on = Me.Controls
Dim count x As Integer
Dim strChkBoxText,s trChkBoxName as String
Dim checked as boolean
count = ctrlCol.Count
For x = 0 To count - 1
ctl = ctrlCol.Item(x)
If TypeOf (ctl) Is CheckBox Then
Dim a As CheckBox
a = CType(ctl, CheckBox)
ctl.Text = "" 'will set the text for that control
strChkBoxText = ctl.Text 'will get the text for that control
strChkBoxName = ctl.Name 'will get the text for that control
checked = aCheckBox.check d 'will check if checkbox is checked
End If
Next x[/CODE] -
Originally posted by programmerboyI hope you are using vb.net. Here is something you can try using.
[CODE=vbnet]Dim ctrlCol As ControlCollecti on = Me.Controls
Dim count x As Integer
Dim strChkBoxText,s trChkBoxName as String
Dim checked as boolean
count = ctrlCol.Count
For x = 0 To count - 1
ctl = ctrlCol.Item(x)
If TypeOf (ctl) Is CheckBox Then
Dim a As CheckBox
a = CType(ctl, CheckBox)
ctl.Text = "" 'will set the text for that control
strChkBoxText = ctl.Text 'will get the text for that control
strChkBoxName = ctl.Name 'will get the text for that control
checked = aCheckBox.check d 'will check if checkbox is checked
End If
Next x[/CODE]
I'm using C#, but I will look this over carefully to see if I can covert the code.
Thanks,
wboswComment
Comment