Here is the code I have now:
Dim startYear As Integer, endYear As Integer
If CheckBox1.Checked = True Then
If Integer.TryParse(startyear.Text, startYear) AndAlso Integer.TryParse(endyear.Text, endYear) Then
datat.DefaultView.RowFilter = "[startofyear] >= '" & startyear.Text & "' and [endofyear] <= '" & endyear.Text & "'"
End If
End If
This filters out by the year, showing the result between both textbox years. However, I am looking to do an exclude function which will start at startyear and end at endyear, but gets all values in between. For instance my year range might be 2000-2005 I would want to exclude from the data set. So, 2000, 2001, 2002, 2003, 2005, and 2005 all would be exlcuded.
What I have tried:
I tried to use not in my statement. for instance,
datat.DefaultView.RowFilter = "not [startofyear] >= '" & startyear.Text & "' and [endofyear] <= '" & endyear.Text & "'"
I have also tried
datat.DefaultView.RowFilter = "[startofyear] <> '" & startyear.Text & "' and [endofyear] <> '" & endyear.Text & "'"
this seemed to almost exclude everything, so I know that its wrong based on the data filtered and displayed in datagridview.