By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

DataGridView validation to underlying DataSource

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
> 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

P: n/a
ok thanks for the hint!
Mar 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.