Changing value of system data column in datagrid
Posted on 2014-03-18
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