Link to home
Start Free TrialLog in
Avatar of imstac73
imstac73

asked on

Changing value of system data column in datagrid

Hi,
I have a datagridview in my windows form where on load I'm creating an additional column in my datagridview with a checkbox in it.  This is for users to be able to select a record and then complete an action on it.  

I have added a textbox and a button to my form.  I want the user to key in a value in the textbox and when they click the button the system will compare a specific column value for each row in the datagridview to the value in the textbox.  If the column value is less than or equal to the textbox value then make the checkbox  value equal selected.

I've found something similar to what I need but this will only allow me to check if the values are equal.
 
Private Sub btnSelectLowAmt_Click(sender As System.Object, e As System.EventArgs) Handles btnSelectLowAmt.Click
        searchvalue2 = CInt(mtxtLowAmt.Text)
        Dim rowIndex As Integer = -1
        For Each row As DataGridViewRow In DataGridView2.Rows
            If row.Cells(7).Value.Equals(searchvalue2) Then
                row.Cells(0).Value = True
                Exit For
            End If
        Next
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of imstac73
imstac73

ASKER

Thanks Carl, I will try it out tomorrow and let you know how it goes.
Carl,
That worked perfect.  Thank you.