Solved

Checkbox column in datagridview

Posted on 2006-11-22
2
927 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

623 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