|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataGridView validation to underlying DataSourceHi,
I'm using a DataGridView with a DataGridViewCheckBoxColumn. When the users checks or unchecks the checkbox, some actions have to happen in the underlying DataSource and other objects. But the underlying DataSource gets only the new value (True or False) on the moment the users leaves the cell with the checkbox, and not on the moment that he checks the record... Does anybody knows how I could get it validationg on the very same moment when the users changes the value? Thanks a lot in advance, Pieter > Does anybody knows how I could get it validationg on the very same moment Watch the cross-posting Pieter. It tends to make people "cross." And "cross" > when the users changes the value? people are less likely to help! ;-) The problem here is, if the focus is still on the cell, how does the DataGridView know that the user is done with it? Yes, with a DataGridViewCheckBoxColumn, arguably the user has clicked on it, and isn't likely to click it again, but on the other hand, since a DataGridViewCheckBoxColumn almost always exposes a bit column, which cannot be indexed, or be a foreign key, what's the hurry? If it's a text box, for example, you definitely want to wait until the user has finished typing! You may use the DataGridView.CurrentCellDirtyStateChanged event to do your validation. I'm presuming that the validation has nothing to do with the underlying DataSource, but with some other business rule. However, if it does, you can call DataGridView.CommitEdit(DataGridViewErrorContexts.Commit) to do any validation in the underlying DataSource. -- Show quoteHTH, Kevin Spencer Microsoft MVP ..Net Developer Presuming that God is "only an idea" - Ideas exist. Therefore, God exists. "Pieter" <pietercou***@hotmail.com> wrote in message news:O1Rwa$PSGHA.4452@TK2MSFTNGP12.phx.gbl... > Hi, > > I'm using a DataGridView with a DataGridViewCheckBoxColumn. When the users > checks or unchecks the checkbox, some actions have to happen in the > underlying DataSource and other objects. But the underlying DataSource > gets only the new value (True or False) on the moment the users leaves the > cell with the checkbox, and not on the moment that he checks the record... > > Does anybody knows how I could get it validationg on the very same moment > when the users changes the value? > > Thanks a lot in advance, > > Pieter > > > |
|||||||||||||||||||||||