I have a function that populates any ComboBox control based on data passed to it. My problem is that, when the function returns the ComboBox, the target CB contains the Items, however, they are not in the DropDownList. Here is mycode below.
Code:
Private Sub LoadUserNameComboBox()
cmbUserName = BL.LoadEmployeeComboBox("LKUP_Users", "ID,name", " WHERE ID >= 0 AND active <> 0", "name")
End Sub
'
'
'
Public Function LoadEmployeeComboBox(ByVal tbl As String, ByVal keyFld As String, ByVal strWhereClause As String, ByVal strOrder As String) As ComboBox
Dim ds As New DataSet
Dim cmb As New ComboBox
Dim arr() As String
arr = keyFld.Split(",")
ds = DL.GetComboBoxData(tbl, keyFld, " WHERE ID >= 0", "ID")
If Not IsNothing(ds) Then
If ds.Tables(0).Rows.Count > 0 Then
Dim x As Integer = 0
For Each row As DataRow In ds.Tables(0).Rows
cmb.Items.Add(row(1))
cmb.DisplayMember = fld2
cmb.ValueMember = fld1
Next
End If
End If
Return cmb
End Function