Drop Down List not filling from dataset

  • Thread starter Thread starter JeffOfJersey
  • Start date Start date
J

JeffOfJersey

Dim dtUsers As New DataTable

Running the following code fills ListBox1 but not ddlUsers (a drop down
list).



Any ideas?



Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Call FillUsers()

With ListBox1

..DisplayMember = "UserName"

..ValueMember = "UserID"

..DataSource = dtUsers

End With

With ddlUsers

..DisplayMember = "UserName"

..ValueMember = "UserID"

..DataSource = dtUsers

End With

End Sub

Private Sub FillUsers()

Dim oSQLHandler As New CRI.SQLHandler("CRISQL2", "Admin", "sa", "")

Dim oSQLCmd As New SqlCommand

Dim oDataAdaptor As New SqlDataAdapter

With oSQLCmd

..CommandText = "pGetJobUsers"

..CommandType = CommandType.StoredProcedure

..Connection = oSQLHandler.OpenConnection

End With

With oDataAdaptor

..SelectCommand = oSQLCmd

..Fill(dtUsers)

End With

oSQLHandler.CloseConnection()

End Sub
 
Back
Top