I have a dataview containing the results of a golf competition. I wish to split the results into three divisions based on "Handicap"
I have two Global Variables namely:
GlobalVariables.DivNo
and
GlobalVariables.DivNo2
which are defined from a csv file as 16 and 20
For the first Division my code, which works satisfactorily, is
Dim LowHandi As String = GlobalVariables.DivNo + 1
MResultsDV.RowFilter = "Handicap <" & LowHandi
the third Division code, which also works satisfactorily, is
MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo2
However my code which needs to filter out the results for handicaps between 17 and 20 does not work.
What I have tried:
My first try was
Dim HighHandi As String = GlobalVariables.DivNo2 + 1
MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo
MResultsDV.RowFilter = "Handicap <" & HighHandi
However, the last filter over wrote the first.
So, I tried
Dim HighHandi As String = GlobalVariables.DivNo2 + 1
MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo And "Handicap <" & HighHandi
but got the following error;
System.InvalidCastException: 'Conversion from string "Handicap >16" to type 'Long' is not valid.'
I then tried
Dim HighHandi As String = GlobalVariables.DivNo2 + 1
MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo AndAlso "Handicap <" & HighHandi
but got this error; System.InvalidCastException: 'Conversion from string "Handicap >16" to type 'Boolean' is not valid.'
I also tried
MResultsDV.RowFilter = '"Handicap >" & GlobalVariables.DivNo' And '"Handicap <" & HighHandi'
which ran but did not work