I have what is in effect 2 different issues that I believe must be related because the technique that I am using is the same. I have a simple form with a simple databound DataGridView. One of the columns of the datasource (which is a datatable from dataset) is a Bit column and therefore renders as a checkbox column in the grid (which is desired). My save procedure involves getting the changes (GetChanges) from the datatable and passing these changes to a routine that uses a SqlDataAdapter to apply the changes to a SQL database. If I take the steps of 1) Loading the DataGridView with data 2) Checking (or unchecking) the one of the checkboxes and 3) immediately save without losing focus of the field -- when I try to GetChanges on my datatable, there are no changes. If I make the change and then move to a different row and save, my GetChanges call has the changes.
In my save logic, before I call the GetChanges procedure against my datatable, I am automatically calling the EndEdit procedure against the DataGridView. EndEdit gets called everytime. This works for all fields except for the checkbox field. For example, if instead of checking/unchecking the checkbox, I edit a text field, this method works just fine and the changes are evident in my GetChanges call.
Another strange thing that I have noticed is that the new row that I enter data into acts the same way. I have left the option to allow users to add rows as default which is True. Therefore the bottom row in the DataGridView is empty with an asterisk in the row header. When I enter data here and again immediately save without going to a different row, the changes are not commited which is evident after the call to GetChanges against the datasource. Again, before the call to the GetChanges procedure is made, I am calling the EndEdit procedure which I expect to commit the changes to the datasource. Also I have noticed that when I edit the bottom row to add a new row, then in my Save procedure call IsNewRow against the ActiveRow of the DataGridView (DataGridView.ActiveRow.IsNewRow) the value is False - I would expect it to be true.
I can attach code tomorrow.
What am I doing wrong here??