It works! Thank you Krunal
I've combined the "Combobox1.selectedvalue.tostring" with the "if then" statement to handle every item in my combobox1 collection and also the posibility of it being nothing.
Here is what I did:
Quote:
Private Sub TextBox12_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox12.TextChanged
If ComboBox1.SelectedItem = Nothing Then
Me.InventarioCompletoBindingSource.Filter = "COD1 LIKE '" & TextBox12.Text & "%' OR EQUIPO LIKE '" & TextBox12.Text & "%' OR MARCA LIKE '" & TextBox12.Text & "%' OR MODELO LIKE '" & TextBox12.Text & "%' OR SERIE LIKE '" & TextBox12.Text & "%' OR UBICACION LIKE '" & TextBox12.Text & "%' OR ZONA LIKE '" & TextBox12.Text & "%' OR LUGAR LIKE '" & TextBox12.Text & "%'OR ESTADO LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Equipo" Then
Me.InventarioCompletoBindingSource.Filter = "EQUIPO LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Marca" Then
Me.InventarioCompletoBindingSource.Filter = "MARCA LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Modelo" Then
Me.InventarioCompletoBindingSource.Filter = "MODELO LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Serie" Then
Me.InventarioCompletoBindingSource.Filter = "SERIE LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Ubicacion" Then
Me.InventarioCompletoBindingSource.Filter = "UBICACION LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Zona" Then
Me.InventarioCompletoBindingSource.Filter = "ZONA LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Lugar" Then
Me.InventarioCompletoBindingSource.Filter = "LUGAR LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Estado" Then
Me.InventarioCompletoBindingSource.Filter = "ESTADO LIKE '" & TextBox12.Text & "%'"
ElseIf ComboBox1.SelectedItem.ToString = "Todos" Then
Me.InventarioCompletoBindingSource.Filter = "COD1 LIKE '" & TextBox12.Text & "%' OR EQUIPO LIKE '" & TextBox12.Text & "%' OR MARCA LIKE '" & TextBox12.Text & "%' OR MODELO LIKE '" & TextBox12.Text & "%' OR SERIE LIKE '" & TextBox12.Text & "%' OR UBICACION LIKE '" & TextBox12.Text & "%' OR ZONA LIKE '" & TextBox12.Text & "%' OR LUGAR LIKE '" & TextBox12.Text & "%'OR ESTADO LIKE '" & TextBox12.Text & "%'"
End If
End Sub