0
votes

I have a form that adds information from the textbox and checkbox to the datagridview. The datagridview only has 2 columns firstname and member column.

I want the application to checkmark the checkbox which is located outside of the datagridview if the selected row has the text "member" in it in the second column. And un-checkmark the checkbox if the selected row has nothing in the member column

So far I got this which displays the first name in the text box, but does not check mark the checkbox if the row contains a text.

If e.RowIndex >= 0 Then

  Dim row As DataGridViewRow
  row = Me.DataGridView1.Rows(e.RowIndex)

  FirstNametxt.Text = row.Cells("Column1").Value.ToString
End If
1

1 Answers

1
votes

Try this code:

YourCheckBox.Checked = IIf(row.Cells("Column2").Value = "member", True, False)