Good morning companions.
I put you in situation. I have, in a form made in vb, a DatagridView that I fill from a query on a database, so far so good.
When I mark the Checks that I want, I have 2 ways to save, by pressing the button where it says Save or by pressing the small button on the top left. The first is a Button and the second is a ToolStripButton within a ToolStripMenu.
If I press the save button, it collects all the clicked checkboxes and makes the insertion in my database. If I press the tiny button, it doesn't pick up the last check I pressed, whatever the line, so it doesn't generate the expected result.
And the big mystery, the code for both buttons is exactly the same!
This is how I collect the values of the grid checkboxes:
For Each row As DataGridViewRow In grdItems.Rows
Dim bool1 As Boolean
Dim bool2 As Boolean
Dim bool3 As Boolean
Dim bool4 As Boolean
Dim bool5 As Boolean
bool1 = Boolean.Parse(row.Cells(4).Value.ToString)
bool2 = Boolean.Parse(row.Cells(5).Value.ToString)
bool3 = Boolean.Parse(row.Cells(6).Value.ToString)
bool4 = Boolean.Parse(row.Cells(7).Value.ToString)
bool5 = Boolean.Parse(row.Cells(8).Value.ToString)
...
Next
As I said, both buttons execute the exact same code and I don't give because they behave differently.
All the best.