473,756 Members | 4,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error provider problems

I am writing a windows application based on a set of generic user controls
that I have developed.

I have a user control called "ctlInputTe xt" that has a label, textbox and
error provider. The error provider is used to ensure that the text box is
completed. There is a property that can be set in the control that disables
the validation so that the control can also be used for situations where the
text box is optional.

My problem is this. I have put 2 of these controls onto a dialog form. The
first control does not require validation, but the second control does. If I
click OK on the form when the focus is on the control that does not require
validation then the dialog closes WITHOUT doing validation on the second box
- this is ofcourse not what I want.

How do I get the form to validate each control when I click the OK button,
not just the control that has focus. Alternatively is there a way that I can
validate the whole form when it is loaded, causing all of the controls that
require dataentry to be flagged with the little icon thing?

Thanks in advance
Huw
Nov 16 '05 #1
3 3842
HpLloyd,

Do you use the validating event?

Cor
Nov 16 '05 #2
Yes, here is the code i am using:

private void ctlTextBox1_Val idating(object sender,
System.Componen tModel.CancelEv entArgs e)
{
if (mvalRequired)
{
string error = null;
if (this.ctlTextBo x1.Text.Length= =0)
{
error = mvalRequiredErr orText;
e.Cancel=true;
}
this.errorProvi der1.SetError(( Control)sender, error);
}
}

mvalRequired is used to dtermine if validation is to be performed or not.
mvalRequiredErr orText holds the text that I want to use in the tooltip

"Cor Ligthert" wrote:
HpLloyd,

Do you use the validating event?

Cor

Nov 16 '05 #3
Hp,

When I see this, is it than not better to set the validating event of the
control dynamicly than the mvalRequiered?

ctlTextbox1.Val idating += new
System.Componen tModel.CancelEv entHandler(this .ctlTextBox1_Va lidating);

Just an idea?

Cor
Nov 16 '05 #4

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

Similar topics

2
3198
by: Alex Vidal | last post by:
Hi, I have windows 2000 server with IIS and I program ASP. I use the string: "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=basedatos.mdb;" to data base Access and it always works ok. But I installed the Panda BusinesSecure Antivirus and since then I have had a lot of problems. First, windows didn't start in normal way, I only could start in Security Mode, so I tried uninstall Panda Antivirus but in security mode I couldn't
1
4148
by: Andy | last post by:
Hi, Please help, I'm getting desperate. Any ideas warmly welcomed! I'm trying to read from a basic excel file (1000 or so rows from column A) but am having problems. The code I am using is: Declare @Return Int SET NOCOUNT ON Exec @Return= .. 'READ_XLS', 'EXCEL', 'Microsoft.Jet.OleDB.4.0' , 'e:\jsbackup\RACodes.xls',
4
9163
by: Martin Franklin | last post by:
I am trying to get a total record count on a Acess 97 mdb database. However I get the following error when I try to load the page: Provider error '80040154' Class not registered http://www.assetresearch.com/clog/count.asp I believe permissions for the IUSR_machine are correct as I am able to add and delete records from the database through other ASP pages in the site. Any ideas on what Class needs to be re-registered. If so, how do I...
2
6034
by: SyrUser03 | last post by:
I am getting this error and I can't seem to figure it out. <% Set cdoConfig = CreateObject("CDO.Configuration") With cdoConfig.Fields .Item(cdoSendUsingMethod) = cdoSendUsingPort ***** ERRORS ON THIS LINE ***** .Item(cdoSMTPServer) = "CT00EXCIM01"
6
539
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange things. When I mimic an multiple user environment by surfin it in multiple browsers simultaneously the site generates a generic runtime error after awhile. I'm thinking this has something to do with my access database and multiple connections. I'm using forms authentication with a login page. Is...
7
9535
by: Alan Pretre | last post by:
I have an application installed at a customer site that has been getting a general network error for a couple of years. I was hoping that .NET 2.0 would clear it up, but unfortunately it didn't. The .NET 2.0 exception does give a little more info than .NET 1.1 did, but not much. Can anybody give any pointers about how to track this down? It occurs every 10 hrs around the clock, like clockwork. I have included the stack trace, but...
3
13969
by: matt.delvecchio | last post by:
i saw a similar post from last year, but i didnt see any clear solution. the error message: "A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) Exception Details: System.Data.SqlClient.SqlException: A connection was successfully established with the server, but then an error occurred...
3
13360
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. On Windows XP Pro, I am using MS Visual Studio 2005, and I am using the developer's edition of...
5
2542
by: Alan Silver | last post by:
Hello, Server configuration: Windows 2003 Server SP2 SQL Server 2000 SP4 ..NET v2.0.50727 just built up a new server using the same configuration as my current one. I even used the same CDs and registration keys, so I'm certain that the two machines are as similar as they can be.
4
2633
by: Porty | last post by:
Hi all, I admittedly don't know the first thing about .NET. I have a new client who has been having problems on her website and asked me to look into it (she has lost contact with the programmer who originally did this work for her). I know some programming languages, but this is not one of them and I am hoping someone can help me. My client has a real estate website and I get the following error (per her complaint) when I try and sign up...
0
9462
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
9287
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
9886
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...
0
9722
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
5155
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
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
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
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
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.