I am currently stuck in one part of my application. I have two combo boxes that i am having the users select from. The first combo box is simply bound to a datatable. that is working properly. The second one i need to populate off another datatable after sorting out what the first one is requesting. Basically it's choosing a line number on the first box and then selecting the machine associated with that line number. The code i have currently is as follows:
Private Sub linecbo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles linecbo.SelectedIndexChanged Dim cline As String Dim mycon As SqlCeConnection Dim mycmd As New SqlCeCommand Dim myDA As New SqlCeDataAdapter Dim myDS As New DataSet Dim myDT As New DataTable cline = linecbo.SelectedText mycon = GetConnect() mycon.Open() mycmd = mycon.CreateCommand mycmd.CommandText = "SELECT Machine, LineNumber FROM machine WHERE LineNumber = '" & Trim(cline) & " ' " myDA.SelectCommand = mycmd myDA.Fill(myDS, "machine") myDT = myDS.Tables("machine") machinecbo.DataSource = myDT machinecbo.DisplayMember = "Machine" machinecbo.ValueMember = "LineNumber" End Sub
The only thing i can think of is that i'm only seeing the first row of the database. i need to see all rows associated with the lines. also when i select other lines from the first combo box my second combo box doesn't update even though i have this code in the index change event of the first combo box. shouldn't this always run whenever the index changes?