Hi,
Anyone knows how to prevent the validating event of a control to be fired
when the user clicks the close button? The OnClosing event of the form seems
to be to late and setting the form's CausesValidatio n property to false
doesn't seem to help either...
Thanks... 1 1714
Alex,
The only suggestion I've seen from Microsoft is to go through your
entire form in your OnClosing event, setting CausesValidatio n on every
control to false. I consider this completely lame.
I suggest creating a bool flag in your form to act as a "don't bother
validating" flag:
private bool dontBotherValid ating = false;
then every _Validating event handler looks like this:
private void aControl_Valida ting(object sender, System.EventArg s e)
{
if (!dontBotherVal idating)
{
.... do validation stuff here ...
}
}
then, in OnClosing, you can add as the first line:
this.dontBother Validating = true;
I know it's not pretty, but I have never found a way to flush pending
Validating events... you seem to have no choice but to have them fire,
so I just accepted that fact and handled the problem within my
Validating event handlers. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robb Meade |
last post by:
Hi all,
A recent project that I had finished and went live with no apparant
problems.
My client received an email from a user who mentioned that by accident they
had been typing (over the querystring I guess), and the url had become
default.asp?pageid='asd
|
by: tshad |
last post by:
I have a logon page that asks for a Logon and Password as well as a
linkbutton that goes to register a new user.
The problem is that if I push the submit button or the linkbutton to
register a new user, it jumps to the validation routine before anything
else. If a user fills in an email and password and then decides to press
the linkbutton to register, it will validate the logon and password and then
go to the register new user page.
...
|
by: Lance |
last post by:
I want to prevent a form from closing when the user clicks the form's Close button in the form's ControlBox (i.e., the button with the "X" in the upper-right corner of the form). Instead, I just want to hide the form. My idea is to do something like the following
Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs
e.Cancel = Tru
MyBase.OnClosing(e
Me.Visible = Fals
End Su
This technique seems to work...
|
by: Phill W. |
last post by:
Has any come across a situation where, in a Form-derived .. er .. Form,
the Event Arguments passed to OnClosing /already/ have their Cancel
argument set to True?
Protected Overrides Sub OnClosing( _
ByVal e As System.ComponentModel.CancelEventArgs _
)
Debug.WriteLine("e.Cancel=(" & e.Cancel.ToString() & ")")
' It's True already !!
|
by: bregent |
last post by:
I've seen plenty of articles and utilities for preventing form injections for
ASP.NET, but not too much for classic ASP. Are there any good input validation
scripts that you use to avoid form injection attacks? I'm looking for good
routines I can reuse on all of my form processing pages. Thanks.
| |
by: kbrolin65 |
last post by:
Hi, folks. Please be patient, as I am not a programmer. But I wasn't
sure where to turn for advice except for a programming discussion
group. I am an intermediate PC user--fairly knowledgeable, but with a
problem that even Web site technical support hasn't been able to solve.
Here's a problem I've never encountered before wwithout a
popup-blocker: inability to connect to Streamaudio.com , a multimedia
site with links to live radio...
|
by: AD |
last post by:
Hi,
I have 2 different web pages, both using RequiredFieldValidator's, on
the one page Postbacks are prevented when required fields are blank,
on the other page the validators display the error messages after the
postback has returned, but neither the client side, nor the server
side processing is suppressed (my incomplete data is written to my
table)
Any idea what could be wrong?
|
by: richard.martino |
last post by:
Windows Experts:
1. I have a desktop application with a UserControl that contains
controls: TextBoxes, RadioButtons, CheckBoxes and NumericUpDowns.
2. I want to warn the user that, if there is unsaved data within my
UserControl when he tries to 'X' out of the entire application, to
display a MessageBox.
3. Unfortunately, System.Windows.Forms.UserControl does not have a
|
by: Steveaux |
last post by:
Hi, I'm new to ASP.Net, so this may be something simple that I
forgot. I have a form where a person can create a login. I'm doing
the processing on this myself. The form has a plethora of validators,
including two custom validators. They check whether the user name
exists among the users already registered, and the same with the email
address. Both the validators process, but they don't stop the form
from processing, so I end up with...
|
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...
|
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...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |