Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27348

VS 2010 If statement with variable operator

$
0
0
Is it possible to build an IF statement with a variable operator?

I have a requirement to allow the end user to select a field No. within a Datagridview, then select an operator from a Combobox and finally select a value. The field No. and value are no problem I just use the following:

If DataGridView1.CurrentRow.Cells(FieldNo).Value = FilterValueBox.Text Then

My problem is I want the user to select an operator i.e. =, <>, <, >, <=, >=

Apart from testing the value in the operator combobox and having a separate If statement for each option is there a way of creating a single IF statement.

Viewing all articles
Browse latest Browse all 27348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>