471,349 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Using a Data Dictionary to Populate a Combobox

Public Function LoadCombo(ByVal myCombo As ComboBox) As Boolean

Dim n As Long, nCount As Long

Dim dict = New Dictionary(Of Long, String)()
For n = 0 To nCount
dict.Add("ID value from File", "Name String from File")


If nCount > 0 Then
Dim bs As New BindingSource()
bs.DataSource = dict

With myCombo
.DisplayMember = "Value"
.ValueMember = "Key"
.DataSource = bs
End With
LoadCombo = true
LoadCombo = false
End If

End function

Veteran VB Programmer
Aug 13 '05 #1
0 4186

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Frazer | last post: by
4 posts views Thread by Mike L | last post: by
reply views Thread by Fraser Guthrie | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.