Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 932
  • Last Modified:

Checkbox column in datagridview

Hello everybody

I have a DataGridView in a C# windows app that I have populated using a DataTable. It works fine for the most part, except when I come to save any changes I have made.

The only editable column is a checkbox column.
When the program is running, if I tick several checkboxes in the column and then save, all the data is saved correctly with the exception of the last box ticked.

I think what's happeneing is that the DataTable used to populate the grid isn't updated when you click the checkbox until the checkbox/grid cell loses focus. I think somehow if I click save direclty after clicking the checkbox, my save methods are running before the DataTable is updated, and so the change is not picked up.

How can I get the DataGridView to update the DataTable as and when the checkboxes are clicked?
0
Rusty_Adams
Asked:
Rusty_Adams
1 Solution
 
Bob LearnedCommented:
Sounds like you have a pending edit:

   this.dataGridView1.EndEdit();

Bob
0
 
Rusty_AdamsAuthor Commented:
Yep! That sorted it, cheers Bob!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now