hello I have a list box reading in data froma database
I also have a button that when clicked will determine which item has been selected in the listbox and do an event accordinly.
problem is when I click the button when no item in the listbox has been selected I get an error. what is the code to determine if no item has been selected
listboxname.?Did you try?
selectedindex >= 0
yea but since no item has been selected that wont work...
perhaps I'll try if selectedindex is not >=0
If none is selected, the value should be -1... I beleive...
Let me get onto one of my webforms and play with it a bit. It's been awhile, so I may be confusing this with winforms. :rolleyes:
Yep, it works. If nothing is selected, the value of listbox.selectedindex is -1.
Sorry for being uncertain, it's been ages since I've done any webforms.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment