473,668 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Avoiding the "valid" callback when a form exits

Tom
I'm making a database input form that has many text boxes
bound to DB fields. I've written a validatedTextBo x
class that inherits from textBox but validates the input
data. It does this with code that overrides
the "onValidati ng" event of textbox.

It all works great except if I exit the form (by clicking
the x in the upper right corner) with invalid data in a
textbox, my onValidating routine gets called and I am
prevented from exiting the form. I would like to know
the form is exiting and ignore the validation in that
case. (There is an accept button the user is supposed to
use if they want to keep the data.) I've looked at
multiple public methods and public properties of the form
but haven't found any which get set or executed before
the onValidation event of my textbox that is on the form.

Any suggestions?
Nov 20 '05 #1
2 1181
Hi,

Make sure the forms causesvalidatio n property is false.

Ken
-----------------

"Tom" <an*******@disc ussions.microso ft.com> wrote in message
news:1e******** *************** ******@phx.gbl:
I'm making a database input form that has many text boxes
bound to DB fields. I've written a validatedTextBo x
class that inherits from textBox but validates the input
data. It does this with code that overrides
the "onValidati ng" event of textbox.

It all works great except if I exit the form (by clicking
the x in the upper right corner) with invalid data in a
textbox, my onValidating routine gets called and I am
prevented from exiting the form. I would like to know
the form is exiting and ignore the validation in that
case. (There is an accept button the user is supposed to
use if they want to keep the data.) I've looked at
multiple public methods and public properties of the form
but haven't found any which get set or executed before
the onValidation event of my textbox that is on the form.

Any suggestions?


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
Nov 20 '05 #2
It was true. I set it to false and it made no
difference. The documentation says this determines if it
does validation on components when the form gets focus.
I am try to exit it the (it has had focus all along.)

Any other ideas?
-----Original Message-----
Hi,

Make sure the forms causesvalidatio n property is false.
Ken
-----------------

"Tom" <an*******@disc ussions.microso ft.com> wrote in messagenews:1e******* *************** *******@phx.gbl :
I'm making a database input form that has many text boxes bound to DB fields. I've written a validatedTextBo x
class that inherits from textBox but validates the input data. It does this with code that overrides
the "onValidati ng" event of textbox.

It all works great except if I exit the form (by clicking the x in the upper right corner) with invalid data in a
textbox, my onValidating routine gets called and I am
prevented from exiting the form. I would like to know
the form is exiting and ignore the validation in that
case. (There is an accept button the user is supposed to use if they want to keep the data.) I've looked at
multiple public methods and public properties of the form but haven't found any which get set or executed before
the onValidation event of my textbox that is on the form.
Any suggestions?

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release

Date: 6/18/2004

.

Nov 20 '05 #3

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

Similar topics

0
3626
by: Tao | last post by:
I just upgraded .NET framework to 1.1 and VS.Net to 2003 version and tried to test it out. I created an ASP.NET project using the wizard and tried to run it by hitting "F5". I got an exception: "Specified cast is not valid." The only thing i put there was a "test this." inside the form. What might be the problem here? Thanks in advance. The Exception:
1
5831
by: Ron Holmes | last post by:
I posted this question on the Crystal Reports Support site and I am still waiting for an answer. Using Crystal Reports 9.0 Developer Full edition: My Crystal report .RPT file has a Picture box which is an OLE Object located in the Page Header section of my .RPT file. This is the call which works perfectly in VB6 to format the crystal reports Page Header section of my report file EquipLst.rpt.
5
1643
by: Yongming Wang | last post by:
FuncA is called to delete itself with B's help. In vc 7.0, case 1 seems invalid, but case 2 is valid. Could anyone explain for me? class A { public: void FuncA() { B b(this);
20
7081
by: Petter Reinholdtsen | last post by:
Is the code fragment 'char a = ("a");' valid ANSI C? The problematic part is '("a")'. I am sure 'char a = "a";' is valid ANSI C, but I am more unsure if it is allowed to place () around the string literal.
11
1971
by: Jim H | last post by:
I am trying to go through my Outlook (2003) address book. The code goes through the Items list and prints all the last names but after it hits 114 (out or 126 contacts) I get a "sepcified cast is not valid" exception thrown. How can it not be valid when that's all the Items collection should contain? I tried using a while loop starting with Items.GetFirst(), then GetNext() but it only gets/prints the first item then loops forever...
2
3088
by: Fabian | last post by:
Hi, I work with asp.net 2.0 and I have a intermittent error, only happens a few times a day. In the page I evaluate a Query String and then I get data form a database. The code snipped: try {
4
3831
by: Mike Cooper | last post by:
There is something about inherited classes I evidently don't know... I wrote the following class: Class Class1 inherits System.Windows.Forms.DataGridTextBoxColumn End Class There is absolutely no added functionality to it.
1
9490
by: Mesan | last post by:
I'm getting a "Cross-thread operation not valid" Exception and I can't figure out why. I've got a BackgroundWorker that creates a UserControl with a whole lot of other user controls inside of it, full of data I'm getting from the database. When my background worker completes I take e.Result and cast it back into a UserControl. I create a TabPage, add the returned UserControl to the Controls of the new TabPage and *BAM* there's my...
7
4808
by: bookon | last post by:
I was running into the System.Drawing.Image.FromStream "parameter is not valid" on some of the images I was retrieving from a blob column in Sql Server. I thought there were corrupt images as almost all worked (all are gifs), and only a few broke when this line ran: Image img = Image.FromStream(ms); here is the original code: b = (byte)dt.Rows.ItemArray; //b.ToString() ms = new MemoryStream(); ms.Write(b, 0, b.Length);
0
8459
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
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8791
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
8575
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
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4202
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
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2784
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
2
2018
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.