Denaes Posted September 20, 2005 Posted September 20, 2005 This is dead easy with a database. Just select one field to be an Item and another (normally the unique key ID in my experience, but not always) to be the ValueMember. Is there a way to configure this relationship manually? Quote
kejpa Posted September 21, 2005 Posted September 21, 2005 This is dead easy with a database. Just select one field to be an Item and another (normally the unique key ID in my experience, but not always) to be the ValueMember. Is there a way to configure this relationship manually? You can make a class like... Public Class cComboItem Private iValue As Integer Private sDisplay As String Public Overrides Function ToString() As String Return sDisplay End Function Public Sub New(ByVal Value As Integer, ByVal Display As String) iValue = Value sDisplay = Display End Sub Public ReadOnly Property Value() As Integer Get Return iValue End Get End Property Public ReadOnly Property Display() As String Get Return sDisplay End Get End Property End Class and then you just add to the proper combobox... cboHands.Items.Add(New cComboItem(0, "None")) cboHands.Items.Add(New cComboItem(1, "One")) cboHands.Items.Add(New cComboItem(2, "Two")) cboHands.Items.Add(New cComboItem(3, "Three")) cboHands.DisplayMember = "Display" cboHands.ValueMember = "Value" HTH /Kejpa Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.