468,247 Members | 1,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,247 developers. It's quick & easy.

DataGridView validation to underlying DataSource

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

Mar 16 '06 #1
2 1629
> Does anybody knows how I could get it validationg on the very same moment
when the users changes the value?
Watch the cross-posting Pieter. It tends to make people "cross." And "cross"
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.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"Pieter" <pi**********@hotmail.com> wrote in message
news:O1**************@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

Mar 16 '06 #2
ok thanks for the hint!
Mar 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by michael sorens | last post: by
7 posts views Thread by =?Utf-8?B?TG9zdEluTUQ=?= | last post: by
6 posts views Thread by hzgt9b | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.