I have a form (vb.net, VS2010) which retrieves product orders and displays the result to a datagridview and text fields. I also have a combo box which displays a list of all products in a product file. I need to set the displayed text of the combo box to match the product name of the ordered product.
When I try to set it as below, all the products in the product list are displayed as one string in the combo box.

Private Sub tbProductName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbProductName.TextChanged
        combProductName2.SelectedText = CType(tbProductName.Text, String)
    End Sub

Recommended Answers

All 2 Replies

combProductName2.SelecedIndex = combProductName2.FindExact(tbProductName.text)

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

For i = 0 To ComboBox1.Items.Count - 1
If UCase(ComboBox1.Items.Item(i).ToString) Like UCase(TextBox1.Text) & "*" Then
End If

Hope this helps you...
End Sub

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.