title: How to implement database searching in datagrid?
body: <p>I am working on a project for my customer. I wrote code to search items from SQL using vb.net.</p>
  
  <p>Now my code working fine. When I search data using itemid it show me data in all related textboxes but not in datagrid. Here is my code:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim connection As New SqlConnection("Server= DESKTOP-QN6F623; Database = dbo_main; Integrated Security = true")
  Dim command As New SqlCommand("select * from items where itemnumber=@itemnumber", connection)
  command.Parameters.Add("@itemnumber", SqlDbType.Int).Value = ItemnumberTextBox.Text
  Dim adapter As New SqlDataAdapter(command)
  Dim table As New DataTable()
  adapter.Fill(table)
  ItemnameTextBox.Text = ""
  If table.Rows.Count() &gt; 0 Then
      ' return only 1 row
      ItemnameTextBox.Text = table.Rows(0)(1).ToString()
      ItembarcodeTextBox.Text = table.Rows(0)(2).ToString()
      ItemnameTextBox.Text = table.Rows(0)(3).ToString()
      ItemdescriptionTextBox.Text = table.Rows(0)(4).ToString()
      ItemcolorTextBox.Text = table.Rows(0)(5).ToString()
      ItemsizeTextBox.Text = table.Rows(0)(6).ToString()
      ItemmaterialComboBox.Text = table.Rows(0)(7).ToString()
      ItemavailablestockTextBox.Text = table.Rows(0)(8).ToString()
      ItempricesTextBox.Text = table.Rows(0)(9).ToString()
      ItemsuppliersTextBox.Text = table.Rows(0)(10).ToString()
      ItembrandnameComboBox.Text = table.Rows(0)(12).ToString()
      ItemlocationComboBox.Text = table.Rows(0)(13).ToString()
  Else
      MessageBox.Show("NO Data Found")
  End If
  </code></pre>
  
  <p>I only want to show searched data in textboxes as well as in datagrid with highlighting.</p>