473,320 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 1817
> 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pieter | last post by:
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...
10
by: michael sorens | last post by:
Is it possible to store an unbound DataGridView component into a setting? I naively tried defining a Setting that is a DataGridView called DGV, then simply assigning it:...
2
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should...
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
0
by: mrstrong | last post by:
Gday, I have a datagridview who's datasource is a view (from oracle) but it has a couple of combo boxes in it that when changed updates the underlying table that this view is based off. ...
5
by: DanThMan | last post by:
The situation: * I have a ButtonColumn in a DataGridView. * When the user preses one of the buttons, a dialog appears. * Based on what the user selects in the dialog, data is entered...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
6
by: hzgt9b | last post by:
Using VS2005, VB.NET, I have a windows app with a DataGridView (lets call it DGV). At some point in the life of my app I want to clear the selection of the currently selected row...
2
by: Oleg Subachev | last post by:
I have DataGridView which DataSource is assigned to Table<> object of DataContext connected to SQL Server database. But when the underlying SQL Server database is updated (through ODBC...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.