Combo boxes

  • Thread starter Thread starter Aaron
  • Start date Start date
A

Aaron

I am sorry if this has been wrtten before but I have been
stuck on this for almost a day. I am trying to manually
add entries to a combo through code with a valuemember
and a displaymember. Here is what I have. I need to
know how to read the valuemember and how to change the
value of the combo based on the drop down. Current Code
is below:

Thanks,
Aaron

Dim c As New ComboItem
c = New ComboItem
c.Value = "00"
c.Display = "00"
Me.cmbDepartFromMinutes.Items.Add(c)
Me.cmbArrMin.Items.Add(c)
Me.cmdDepMin.Items.Add(c)
c = New ComboItem
c.Value = "15"
c.Display = "15"
Me.cmbDepartFromMinutes.Items.Add(c)
Me.cmbArrMin.Items.Add(c)
Me.cmdDepMin.Items.Add(c)

to set:
Me.cmdDepMin.SelectedValue = "15"



Public Class ComboItem
Private sDisplay As String
Private sValue As String

Public Property Display() As String
Get
Return sDisplay
End Get
Set(ByVal Value As String)
sDisplay = Value
End Set
End Property

Public Property Value() As String
Get
Return sValue
End Get
Set(ByVal Value As String)
sValue = Value
End Set
End Property

Public Overrides Function ToString() As String
Return Display
End Function
End Class
 
Back
Top