P
postings
Hi
I am constantly dealing with situations whereby it would be nice to
have, say, a couple more values embedded in a listbox, that would be
nice and easy to retrieve in code.
i.e. like this:
----------------------------------------------------
Dim li = New ListItem
li.text = "Pounds Sterling"
li.value = "1"
li.value2 = "100" 'Note Value2 is not a real property
ddlTest.Items.Add(li)
li.text = "Dollars"
li.value = "2"
li.value2 = "135" 'Note Value2 is not a real property
ddlTest.Items.Add(li)
End Sub
----------------------------------------------------
So when the user select the listbox, not only can I access
ddlTest.SelectedItem and ddlTest.Selectedvalue, but I could also have
ddlTest.Selectedvalue2
I'm always having to write code around listboxes, and generally I end
up putting a few overflow values in a viewstate array, which can get
very messy having to iterate through this sort of code.
I am wondering, how would you go about adding an extra value property
to the base class of a listbox, be able to retrieve this value, and
still be able to drag a ddlistbox onto the form in VS2003.
How simple would this be to achieve?
Has anybody achieved it?
Any examples or comments?
Cheers
Alex
I am constantly dealing with situations whereby it would be nice to
have, say, a couple more values embedded in a listbox, that would be
nice and easy to retrieve in code.
i.e. like this:
----------------------------------------------------
Dim li = New ListItem
li.text = "Pounds Sterling"
li.value = "1"
li.value2 = "100" 'Note Value2 is not a real property
ddlTest.Items.Add(li)
li.text = "Dollars"
li.value = "2"
li.value2 = "135" 'Note Value2 is not a real property
ddlTest.Items.Add(li)
End Sub
----------------------------------------------------
So when the user select the listbox, not only can I access
ddlTest.SelectedItem and ddlTest.Selectedvalue, but I could also have
ddlTest.Selectedvalue2
I'm always having to write code around listboxes, and generally I end
up putting a few overflow values in a viewstate array, which can get
very messy having to iterate through this sort of code.
I am wondering, how would you go about adding an extra value property
to the base class of a listbox, be able to retrieve this value, and
still be able to drag a ddlistbox onto the form in VS2003.
How simple would this be to achieve?
Has anybody achieved it?
Any examples or comments?
Cheers
Alex