Mondeo
Centurion
Hi,
I have a combobox on a form, I noticed that unlike the dropdownlist in asp.net which has a collection of ListItems the combobox can hold any object. So I created a ListItem class to use.
Then I added items to the combobox like this
Dim li as new listitem("My Text","My Value")
cboDealers.Items.Add(li)
I want to bind the value of the combobox to a datasource using Databindings.Add, but which property contains the value, is it a property of the listitem class I need to use or the combobox itself?
Thanks
I have a combobox on a form, I noticed that unlike the dropdownlist in asp.net which has a collection of ListItems the combobox can hold any object. So I created a ListItem class to use.
Visual Basic:
Public Class ListItem
Dim _text, _value As String
Property Text() As String
Get
Text = _text
End Get
Set(ByVal val As String)
_text = val
End Set
End Property
Property Value() As String
Get
Value = _value
End Get
Set(ByVal val As String)
_value = val
End Set
End Property
Sub New(ByVal inText As String, ByVal inValue As String)
Me.Text = inText
Me.Value = inValue
End Sub
Public Overrides Function ToString() As String
Return Me.Text
End Function
End Class
Then I added items to the combobox like this
Dim li as new listitem("My Text","My Value")
cboDealers.Items.Add(li)
I want to bind the value of the combobox to a datasource using Databindings.Add, but which property contains the value, is it a property of the listitem class I need to use or the combobox itself?
Thanks