473,811 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validating event

Is there a way to cancel the validating event on the
closing event?

I have 2 textboxes that I use the validating event to
check for numeric data. If I try to close the form
without putting a number in, it calls the validate event
and pops up my MsgBox.

Thanks!
Nov 20 '05 #1
4 3042
Cor
Eric.
Take a look for the keywords cancel validating event on MSDN.
This handles it, but I forgot if it was e.cancel= true or e.cancel=false
take a look what it is in your situation.
I thought it was true.
Cor
Nov 20 '05 #2
-----Original Message-----
Eric.
Take a look for the keywords cancel validating event on MSDN.This handles it, but I forgot if it was e.cancel= true or e.cancel=falsetake a look what it is in your situation.
I thought it was true.
Cor
Cor,
The problem is that I also have a closing event. If I am
validating data in a textbox for numeric values, using
IsNumeric, and the text box is empty and I click my exit
button, it is calling that TextBox validating event.
Where would the code go to not call this validating event?

Nov 20 '05 #3
Cor
Hi Eric
There was a good sollution in this newsgroup from Jeffrey Tan,
Someone cleaned it up.
There stayed another sollution from Jeffrey, describes the problem good, but
gives not such a nice sollution.
After that in a good discussion wherein I was involved a Billy, Jeffrey
changed his sollution to the right one.
That sollution is still partial in this newsgroup on 29-8 too but only some
end thread OT discussion.
I thougth it would stay, so I could find it on Google, but someone has
cleaned it up.
Sorry for you,
I d' nt have it now and d'nt remember it exact and I said to someone to look
something over before, so I do that first.
I placed Jeffreys name in the subject, maybe he sees it and has it still so
he can repost it.
Cor
Nov 20 '05 #4
-----Original Message-----
Hi Eric
There was a good sollution in this newsgroup from Jeffrey Tan,Someone cleaned it up.
There stayed another sollution from Jeffrey, describes the problem good, butgives not such a nice sollution.
After that in a good discussion wherein I was involved a Billy, Jeffreychanged his sollution to the right one.
That sollution is still partial in this newsgroup on 29- 8 too but only someend thread OT discussion.
I thougth it would stay, so I could find it on Google, but someone hascleaned it up.
Sorry for you,
I d' nt have it now and d'nt remember it exact and I said to someone to looksomething over before, so I do that first.
I placed Jeffreys name in the subject, maybe he sees it and has it still sohe can repost it.
Cor
.
Thanks

Nov 20 '05 #5

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

Similar topics

6
5805
by: Alex Bink | last post by:
Hi, I have a validating event on a textbox in which I want to prevent the user to leave the textbox without entering the right data. Only if he clicks on another specific control he is allowed to leave the textbox without entering the right information. Is there a way to determine which other control was clicked in the validating event of the textbox? Thanks
0
1557
by: Joe | last post by:
Hi For a while now I have been finding postings of problems with the validating event not firing on controls properly. I too had this problem. The event would fire when clicking on another control which had it's causes validation property set to true however if I tabbed on to this control the event wouldn't fire. So after playing around with my code I figured out how to get it to work. I am not sure what the reason behind it is but it...
2
2131
by: Chris Dunaway | last post by:
I have a form with a textbox and numerous panels, buttons and other controls. I have handled the textbox Validating and Validated events. The textbox will hold a filename. In the validating event, I check that the string in the textbox is a file that exists or whether or not the string is blank and display a message box in either case. I also call e.Cancel so that the value will be corrected. However, certain buttons on the form...
0
2475
by: Matthew | last post by:
All, I have searched google and the newsgroups but can't find anything the same as what I am experiencing (though I may have missed something). I have controls (textboxes) within UserControls which are not behaving as I would expect. Specifically, if there is a command button external to the usercontrol which is activated by a shortcut key (eg Alt-B), the command button Click event handler code 'executes' even though the textbox set...
0
2441
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using. I took the sample from that article and recreated the situation I see in my application. (Code included below.) If you run the...
21
9225
by: Darin | last post by:
I have a form w/ a textbox and Cancel button on it. I have a routine to handle textbox.validating, and I have the form setup so the Cancel button is the Cancel button. WHen the user clicks on the cancel button, the textbox.validating is being called. I don't want it to be since they are exiting the screen the validation doesn't have to be done. How can I do that.
4
2484
by: easoftware | last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two Mdi child forms. I need to validate data in the Mdi form. The Form.Validating event works when I try to close a Mdi form, but not when I try to switch form one Mdi form to the other. I tried to add code to MdiForm1's Deactivate event: Private Sub MidForm1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate Dim TempE As...
6
4758
by: Ryan | last post by:
I have a windows form that I want to force validation on controls (text boxes) when the user clicks a "Save" button. The only way I've found to do this is to cycle through every control and call it's .Select() method. This is clunky though because you can see a flash in each text box as it's being validated. Here's my code Private Sub Save() For each c as control in Me.Controls If c.CanSelect() then c.Select()
16
5514
by: Al Santino | last post by:
Hi, It appears displaying a messagebox in a validating event will cancel the subsequent event. In the program below, button 2's click event doesn't fire if you open a dialog box in button 1's validating event. Am I doing something wrong here? Thanks Al Imports system
3
2801
by: TheSteph | last post by:
Hi Experts ! I have a Winform Program in C# / .NET 2.0 I would like to ensure that a value in a TextBox is a valid Int32 when user get out of it (TextBox loose focus)
0
9605
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
10651
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...
1
10403
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
10136
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...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
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
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.