Combo box datasource using Dictionary

Public Sub Gender(ByVal objcombo As ComboBox)
Dim objGender As New Dictionary(Of String, String)

objGender.Add(”M”, “Male”)
objGender.Add(”F”, “Female”)

Dim mBinding As New BindingSource

mBinding.DataSource = objGender

objcombo.DataSource = mBinding
objcombo.DisplayMember = “Value”
objcombo.ValueMember = “Key”
End Sub

, , ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth