I know it'll be something dumb but I just can't figure out how to properly set the displaymember and valuemember. THis is what I have so far.
Form load:
Then when I double click the selectedvalue is null.
Could someone point out my mistake please? Thanks!
VB.NET:
Private Class cControllerListBoxEntry
Private m_strName As String
Private m_strSerial As String
Public Property Name() As String
Get
Return m_strName
End Get
Set(ByVal Value As String)
m_strName = Value
End Set
End Property
Public Property Serial() As String
Get
Return m_strSerial
End Get
Set(ByVal Value As String)
m_strSerial = Value
End Set
End Property
Public Overrides Function ToString() As String
Return m_strName
End Function
End Class
Form load:
VB.NET:
Dim myEntry As cControllerListBoxEntry = New cControllerListBoxEntry
lsbControllers.DisplayMember = "Name"
lsbControllers.ValueMember = "Serial"
myEntry.Name = "Machine2-192.168.1.100"
myEntry.Serial = "799342"
lsbControllers.Items.Add(myEntry)
Then when I double click the selectedvalue is null.
VB.NET:
Private Sub lsbControllers_DoubleClick(sender As Object, e As System.EventArgs) Handles lsbControllers.DoubleClick
MsgBox(lsbControllers.SelectedItem.ToString & " " & Str(lsbControllers.SelectedValue.ToString))
End Sub
Could someone point out my mistake please? Thanks!