Sorry for not giving enough info. Here is the code I use for displaying the
items in the combobox:
strSQL = "Select MachineType From MachType"
Using conn As New SqlClient.SqlConnection _
("Server=" & dbServer & ";Database=" & dbDatabase & ";User ID="
& dbUserName & ";Password=" & dbPassword)
Using com As SqlClient.SqlCommand = conn.CreateCommand
conn.Open()
ds = New DataSet
da = New SqlClient.SqlDataAdapter(strSQL, conn)
da.Fill(ds, "MachType")
Dim ac As New AutoCompleteStringCollection
For Each dr As DataRow In ds.Tables("MachType").Rows
ac.Add(dr.Item("MachineType").ToString)
cboMachType.Items.Add(dr.Item("MachineType").ToStr ing)
Next
cboMachType.AutoCompleteMode = AutoCompleteMode.Append
cboMachType.AutoCompleteSource =
AutoCompleteSource.CustomSource
cboMachType.AutoCompleteCustomSource = ac
End Using
End Using
The problem with this is when I select an item from the drop down, it
duplicates all the items so I have two of each item in the drop down. If I
close the form and reopen it and select the drop down, there will still be
duplicates of each item. And the next time there will be four of each item
and so on.
I tried using the same code for the second combobox and using the
"SelectedItem" as the search criteria in the "SQL Search" statement but I
coulnd't get it to work.
Let me know if you need more information.
Thanks,
Mike S.
"Cor Ligthert[MVP]" wrote:
Mike,
Assuming that you use dataviews (you did not give any information about this
to us)
Set the result of combobox 1 as rowfilter in the dataview of combobox 2
Cor