Solved

Checkbox column in datagridview

Posted on 2006-11-22
2
925 Views
Last Modified: 2012-08-13
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
Comment
Question by:Rusty_Adams
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17998874
Sounds like you have a pending edit:

   this.dataGridView1.EndEdit();

Bob
0
 

Author Comment

by:Rusty_Adams
ID: 18001443
Yep! That sorted it, cheers Bob!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question