473,385 Members | 1,875 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,385 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 4311
> 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:...
8
by: George | last post by:
Hi, I have been trying to see if I can do the following: 1. Create a DataGridView 2. Create 2 columns in the DataGridView (1 textbox and the other combobox) 3. Create a DataTable containing...
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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.