title: Filtering DataGridView VB
body: <p><em>note</em>: all column data is stored as nvarchar</p>
  
  <p>My search function keeps giving me errors which I don't understand. Basically, I have a comboBox where the user can choose to filter the search to a specific column in the datagridview, then they can type their search in the textbox and click the button to search. </p>
  
  <p>Types of errors I'm getting:
  Syntax error: Missing operand after 'Native' operator. // I typed in the search textbox "Bold Native" and used the column filter "Films"
  Cannot perform 'Like' operation on System.String and System.Int32. // I typed in the search textbox "1979" and used the column filter "Year"</p>
  
  <p>Very simple code, just a big if/elseif statement for each column of the database (excuse the dashes):</p>
  
  <pre><code>Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
      --If ComboBox1.Text = "          No Filter          " Then
       ----Me.FilmsBindingSource.Filter = Me.FilmsBindingSource.Filter = "Films LIKE " + TbFilter.Text + "% OR Actors LIKE " + TbFilter.Text + "% OR Directors LIKE " + TbFilter.Text + "% OR Writers LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Films" Then
       ----Me.FilmsBindingSource.Filter = "Films LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Year" Then
       ----Me.FilmsBindingSource.Filter = "Year LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Duration" Then
          ----Me.FilmsBindingSource.Filter = "Duration LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Actors" Then
          ----Me.FilmsBindingSource.Filter = "Actors LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Directors" Then
          ----Me.FilmsBindingSource.Filter = "Directors LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Writers" Then
          ----Me.FilmsBindingSource.Filter = "Writers LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Own It?" Then
          ----Me.FilmsBindingSource.Filter = "Own It? LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Seen it It?" Then
          ----Me.FilmsBindingSource.Filter = "Seen It? LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Rating" Then
          ----Me.FilmsBindingSource.Filter = "Rating LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Top 10" Then
          ----Me.FilmsBindingSource.Filter = "Top 10 LIKE " + TbFilter.Text
      --ElseIf ComboBox1.Text = "Misc" Then
          ----Me.FilmsBindingSource.Filter = "Misc LIKE " + TbFilter.Text
      --End If
  End Sub
  </code></pre>
  
  <p>I'm trying to figure out a better way to filter/search but I haven't come up with any solutions yet. Any ideas?</p>