Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What am i doing wrong?

Status
Not open for further replies.

e106199

Programmer
Nov 17, 2005
27
0
0
US
Hi all,

i have a bunch of checkboxes (not checkbox list for some reason) and i collect all their data under a field. So if user selects cbA and cbC; A,C is sent to database.

Now i want to load my form so user can make some changes. Everthing works fine but i m doomed with the checkboxes. Here is what i do: i get the value as a string which is A,C in my case and split it into an array. So i have myArray which has 2 items; A and C.

And i make a check and compare the array items with the checkbox values and if there is a match i set checkbox.checked to true.

Dim myArray As Array = Split(myString, ",")

Dim i As Int16

For i = 0 To myArray.Length - 1

If myArray(i) = "A" Then checkbox1.Checked = True

If myArray(i) = "B" Then checkbox2.Checked = True

If myArray(i) = "C" Then checkbox3.Checked = True

Next

the debug shows checkbox1 and checkbox3 should be checked cause it runs checkbox1.checked=true part and checkbox3.checked=true but they are not checked when the page is loaded.

What am i doing wrong here. Is there something i m missing?

thank you

-shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top