I'm having dificulty figuring out how to process multiple check boxes on a
web form.
Let's say I have three check boxes:
cbox1
cbox2
cbox3
The only way I can think of to code the possibilities is something like:
If cbox1.checked = true then
..........
End if
If cbox2.checked = true then
.......
End If
If cbox3.checked = true then
.......
End if
If cbox1.checked = true and cbox2.checked = true then
.......
end if
If cbox1.checked = true and cbox3.checked = true then
.......
end if
And the If/End IFs go on forever!
As you can see, if I have around 8 check boxes, doing it this way could lead
to tremendous amounts of coding. I'm sure there's a better, easier way,
right? I thought of using a select case but that wouldn't be much better I
don't think.
Terry in the dotnet.vb newsgroup gave this suggestion:
dim c as integer = 0
if cbox3.Checked = True then c = 1
if cbox2.Checked = True then c += 2
if cbox1.Checked = True then c+=4
Select Case c
Case 0 'No checks
Case 1 'cbox 3
Case 2 'cbox 2
Case 3 'cbox 2 & 3
Case 4 'cbox 1
Case 5 'cbox 1 & 3
Case 6 'cbox 1 & 2
Case 7 'cbox 1,2, & 3
End Select
I thought this was a great idea, but when you have 7 checkboxes, that still
leaves 128 Cases within a select case statement to program.
Is there a dynamic way to code this scenario that works with web forms?
The application is a query that runs against a single table in an access
database. Each check box represents each field they could chose from to show
up in a table or other style report.
TIA,
Jim