A
Amy Snyder
For what I thought would be a very simple task is turning out to be very
frustrating. I have been trying for a day now to extract checkbox
values from my form and nothing is working.
On my form load I am setting the values of my checkboxes:
chk1.Attributes.Add("checkValue", "151010")
chk2.Attributes.Add("checkValue", "151020")
chk3.Attributes.Add("checkValue", "151030")
chk4.Attributes.Add("checkValue", "151040")
chk5.Attributes.Add("checkValue", "151050")
...
When the submit button is clicked, I want to loop through all checkboxes
and retrieve the value of the checkboxes that were selected.
Dim ctrl As New Control
Dim chk As New CheckBox
Dim strIndustry As String
' Loop through all the controls on the panel.
' Create the string for the SQL statement.
For Each ctrl In pnlSearchResults.Controls
If TypeOf ctrl Is CheckBox Then
' Get value of checkbox
End If
Next
I have tried a few different ways and keep getting errors. Could
someone please provide a solution? Thanks!
frustrating. I have been trying for a day now to extract checkbox
values from my form and nothing is working.
On my form load I am setting the values of my checkboxes:
chk1.Attributes.Add("checkValue", "151010")
chk2.Attributes.Add("checkValue", "151020")
chk3.Attributes.Add("checkValue", "151030")
chk4.Attributes.Add("checkValue", "151040")
chk5.Attributes.Add("checkValue", "151050")
...
When the submit button is clicked, I want to loop through all checkboxes
and retrieve the value of the checkboxes that were selected.
Dim ctrl As New Control
Dim chk As New CheckBox
Dim strIndustry As String
' Loop through all the controls on the panel.
' Create the string for the SQL statement.
For Each ctrl In pnlSearchResults.Controls
If TypeOf ctrl Is CheckBox Then
' Get value of checkbox
End If
Next
I have tried a few different ways and keep getting errors. Could
someone please provide a solution? Thanks!