473,761 Members | 4,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a global validate on a winform?

I know how to use the ErrorProvider in my winforms..or do I? I validate
the values and set the ErrorProvider in the validating event. If not
valid, I set e.Cancel = True. I clear the ErrorProvider in the
validated event.

Is there a way to know if all validated controls pass validation when
the user clicks an OK button? In ASP.Net there's the Page.IsValid
method. Is there something similar in winforms, or do I still have to
write an overall validate routine to fire on the button click? I tried
Me.Validate(), but that always returned true...I guess I have to put my
final validations in the forms validate event?

It seems to me that form validation is much easier in ASP.Net apps.

Oct 6 '06
11 11764
It does appear in msdn2's documentation for the ContainerContro l class.
The documentation doesn't say so, but it appears to have been added in
..NET 2.0, which is why neither you nor I can find it in our docs for
..NET 1.1 (aka VS 2003).

jj******@hotmai l.com wrote:
In what class is Validate and ValidateChildre n a member? In searching
the VS .Net 2003 help, there is no entry for ValidateChildre n. What am
I missing here?

Dave Sexton wrote:
Hi,
Hmmm, am I missing a thread,
Do you mean that you can't see our posts? What news reader are you using?
or is ValidateChildre n in 2.0 only?
Nope.
I went ahead and created a custom control that inherits Textbox and
added this simple method (sorry for the VB instead of c#):
>
<snip code>
>
This gives me what I want. I think I'll add a property called something
like AllowExitOnFail edValidation that I can check so I could still fire
Validating but choose whether or not to set e.Cancel. That way the
error will be shown, but they could still leave the field. Sometimes
users may want to tab past a required field to fill out another part of
form first. In my OK click, I do the following:
>
<snip code>

I think Bruce Wood's post addresses your concerns. Just set CausesValidatio n = false on your control too so that the user can tab
through it without being forced to enter valid data.

--
Dave Sexton
Oct 6 '06 #11
Hi Bruce,

Well that's just terrible. Thanks for the info and sorry for the confusion.

Hey, at least they addressed the issue in 2.0 :)

--
Dave Sexton

"Bruce Wood" <br*******@cana da.comwrote in message news:11******** *************@b 28g2000cwb.goog legroups.com...
It does appear in msdn2's documentation for the ContainerContro l class.
The documentation doesn't say so, but it appears to have been added in
.NET 2.0, which is why neither you nor I can find it in our docs for
.NET 1.1 (aka VS 2003).

jj******@hotmai l.com wrote:
>In what class is Validate and ValidateChildre n a member? In searching
the VS .Net 2003 help, there is no entry for ValidateChildre n. What am
I missing here?

Dave Sexton wrote:
Hi,

Hmmm, am I missing a thread,

Do you mean that you can't see our posts? What news reader are you using?

or is ValidateChildre n in 2.0 only?

Nope.

I went ahead and created a custom control that inherits Textbox and
added this simple method (sorry for the VB instead of c#):

<snip code>

This gives me what I want. I think I'll add a property called something
like AllowExitOnFail edValidation that I can check so I could still fire
Validating but choose whether or not to set e.Cancel. That way the
error will be shown, but they could still leave the field. Sometimes
users may want to tab past a required field to fill out another part of
form first. In my OK click, I do the following:

<snip code>

I think Bruce Wood's post addresses your concerns. Just set CausesValidatio n = false on your control too so that the user can
tab
through it without being forced to enter valid data.

--
Dave Sexton

Oct 6 '06 #12

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

Similar topics

1
2166
by: John Indra | last post by:
Hello all... I need to have global data available within the lifetime of my Winform app, accessible from any objects this application might spring at runtime. In ASP.NET, I can just create this holder object, put this object in (System.Web.SessionState.HttpSessionState)Session object, and whenever I need to access the global data from virtually any object having access to the Session object, I just call
2
3499
by: Bryan | last post by:
Hello, I'm just starting to develop in asp.net and i have a question about using a database connection globally in my app. I have set up the procedures for getting all my connection string info which each page will use, but my question relates to how to use the database connection i create in all my classes. I have a database class, in a separate namespace and file, i created that handles all the connection opening, executing statements...
7
2921
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*" path="*.sgf" type="CustomExtensionHandler, Extenders.CustomExtensionHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d831d925597c1031" validate="True"/> </httpHandlers>
2
6027
by: Kevin Yu | last post by:
hi all got a questoin here, I have a winform client to call web service and the web service functions have EnableSession =ture, use IE to test the web service session, it works, but how to get it to work in winform? it seems like every call to the service will start a new session even if the web service object is a global variable in the winform. kevin
4
1439
by: Water Cooler v2 | last post by:
I want to register a hotkey for my WinForm so that when I hold the, say, Alt+M keys, it minimizes. How do I do that?
1
7335
by: Marek | last post by:
Hi all, who can give me an answer on this question: how to validate controls on WinForm? So clicking on AceptButton does not return control from WinForm to program until all controls have proper values. TIA, MP
1
1734
by: paulo | last post by:
Hello, I have a DLL library containing some web services which are declared in each .asmx file in the following way: <%@ WebService Language="C#" Class="LibraryName.WebService" %> I would like to log every unhandled exception that occurs on any web service declared in the library to a file. I noticed the global class, usually inside global.asax has the Application_Error event that can be
3
1549
by: Rodrigo Juarez | last post by:
Hi Microsoft Visual Studio 2005, Visual Basic and winforms application I need a global error handler, where should I put that. Any examples? TIA Rodrigo Juarez
2
1381
karthickkuchanur
by: karthickkuchanur | last post by:
Iam developing visual studio window application i have lot o textbox in it how can i validate when the user enter the value,if it is in web form means i can easily validate using javascript.please help me how can test it whether if correct or not and another thing id iam not want to validate the testbox indivitually please sent me the logic using looping condition or something else
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
9345
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,...
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,...
1
7332
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
6609
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();...
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.