DataGridView - VB 2010 - Checkbox

Simple Man

Member
Joined
Jul 7, 2010
Messages
13
Programming Experience
5-10
I've got a SQL table with the following columns: username (varchar), Active and Admin (both bit).

I've created my tableadapter and on my form i've got a datagridview that shows the data. Username can't be edited, but Active and Admin can...both are checkboxes.

Without having a "save" button, I want to update my SQL table after the users has changed the cell value...either the Active or Admin column. So basically, it is a real time update after they a cell value.

This doesn't seem as easy at it sounds. I've looked at the CurrentCellDirtyStateChanged event, added code within this event if the cell is a checkboxcell to run the following command: dgvUser.CommitEdit(DataGridViewDataErrorContexts.Commit)

I've tried to run Update on the tableadapter but still doesn't work.

I should also mention...I would like to datatable/sqltable get update after the user clicks the checkbox....not after leaving the row.

Anyone have some ideas to help me into the right direction?

Thanks.
 
Last edited:
Back
Top