473,761 Members | 7,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView CellValidating event triggers MORE OFTEN than I need, I think???

After a user edits a Cell in one of my DataGridViews, I want to make
sure what the user has typed in is 'valid'. If it's not, I want to
Cancel the Edit.

Ok, you say, use the CellValidating event for this. That's fine, I
have... BUT...

As you experts probably know, the CellValidating event triggers not
just when a user EDITS a cell, but seemingly any time a Cell is
selected. (Feel free to tell me I'm wrong about this, by the way).

All I want to do is trigger a message to the User after he finishes
editing a Cell letting him know if there is a problem with what he has
typed into the Cell.

Well, you say, use the CellEndEdit event. Well, I would... if that
event had a "Cancel" capability (which the CellValidating event *does*
have), but the CellEndEdit doesn't have a "Cancel" capability.

I guess I could trigger a message in CellEndEdit and inform the user
in a Msgbox that he should hit the 'Esc' key to return to the cell's
previous value... but I'm wondering if this is the most efficient way
of handling what I'm trying to accomplish.

I thank you in advance for your help.
Aug 20 '08 #1
0 1306

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
15407
by: Matt | last post by:
In many places in my application, I have a DataGridView which users can either enter data into or use as a method of navigation in a master/detail form view. I need a method of stopping the user from leaving a row if there is invalid data in it (e.g., a field that cannot be null is). Because there is no Cancel argument on the parameters for the RowLeave event, I can manage to catch the error and throw up a message, but I am unable to stop...
3
2050
by: Pieter Coucke | last post by:
Hi, When a user types a non numeric-value in a numeric column in a DataGridView, and he tries to leave the cell, he gets this "Input string was not in a correct format."-exception. Is there a (nice) way to get rid of this exception? And just put a "0" in the place? Or somehow trigger this single exception (does exceptions have a unique type-number?) and do some appropriate actions?
2
13324
by: Greg | last post by:
I'm new to the datagridview control, and am left wondering how one goes about restricting input to numeric only. Is it possible to trap key presses at the cell level, and in the relevant columns, ignore them if non-numeric? Greg.
1
1368
by: Dave | last post by:
I have a datagridview I call the CellValidating event and if the the cell does not validate I want to reset the cell to a default value. My code actually executes this statement: datagridview1.CurrentRow.Cells.Value = defaultValue; but the statement does not change the cell at all. -- L. A. Jones
7
16458
by: Ryan | last post by:
I have a DataGridView which displays numeric (Int32) data from an underlying database. I want the numbers to be displayed in numeric format "#,###" (with commas). I want to also limit the user so they can only input numerical values. Is there any way to do this? Currently my formatting works but if the user enters a value manually the formatting is not applied to the new value. Also I haven't found a way to allow only numerical input....
0
3032
by: Leon_Amirreza | last post by:
Its seems very logical that when a user changes a value in a cell first CellValidating and then CellParsing would get called. But can I cache the value Parsed in CellValidating (To Actually validate the user's value) in an object to be used by CellParsing safely? In other words does this piece of code works or when inside the CellParsing I should not assume the value of "b" variable is usable (because DataGridView may have called...
5
6346
by: TheSteph | last post by:
Hi ! I have a DataGridView with a Date (DateTime) Column. When a user edit the cell and change the date I woulk like to allow him to write "081501" and programmatically transform the entered date to "2008/15/01"( using a custom method called TransformDate(string ARawDate)) But I can't find any DataGridView event to call the TransformDate method and replace the user input by the computed value. I always get a "DataError".
0
2724
by: systeko | last post by:
Hello, I have one little problem which make me crazy. I've made application (for Windows) in Visual C#. On one panel I've got datagridview control which is not bind to database, I populate it manualy. It has 4 columns and only one can be edited and user can put some numbers in it (It is float type). I want to validate ie. to check if that value is in some boundaries (min and max value is in 2. and 3. column and column for editing is 1.). If...
9
3423
by: Miro | last post by:
My current headache is proper is with the datagridview I am starting to realize that a DataGridView within vs2008 is not as 'robust' as a 'textboxfield' by default for example. Example: A Textbox field can have masking, you can add easy validation and so on. Just adding a dummy datagridview to a form, databounding it, and allowing editing works - but is not dummy proof.
0
9531
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10115
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8780
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3456
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.