I have a form with a bunch of textboxes. Each text box gets validated
with the ErrorProvider. I want the form to process something ONLY when
ALL the textboxes are valid.
I found a solution, but it seems like a workaround. I'm not sure if
it's the best way:
Dim ErrorCounter As Integer
Private Sub btnOK_Click(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles btnOK.Click
If TextBox1.Text = "" Then
ErrorProvider1. SetError(TextBo x1, "Error")
ErrorCounter += 1
Else
ErrorProvider1. SetError(TextBo x1, "")
End If
If TextBox2.Text = "" Then
ErrorProvider1. SetError(TextBo x2, "Error2")
ErrorCounter += 1
Else
ErrorProvider1. SetError(TextBo x2, "")
End If
If ErrorCounter = 0 Then
'process code that only happens when there are NO errors
End If
End Sub
Is this a good way to handle it, or am I missing a better technique?
Thanks!
John 1 1060
Hello John, I have a form with a bunch of textboxes. Each text box gets validated with the ErrorProvider. I want the form to process something ONLY when ALL the textboxes are valid. I found a solution, but it seems like a workaround. I'm not sure if it's the best way:
Dim ErrorCounter As Integer
Private Sub btnOK_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles btnOK.Click If TextBox1.Text = "" Then ErrorProvider1. SetError(TextBo x1, "Error") ErrorCounter += 1 Else ErrorProvider1. SetError(TextBo x1, "") End If
If TextBox2.Text = "" Then ErrorProvider1. SetError(TextBo x2, "Error2") ErrorCounter += 1 Else ErrorProvider1. SetError(TextBo x2, "") End If
If ErrorCounter = 0 Then 'process code that only happens when there are NO errors End If End Sub
Is this a good way to handle it, or am I missing a better technique?
I have no better idea _ seems this is OK.
If you are interested have a look at: http://www.help-info.de/en/Visual_Ba...t.htm#download
HTH
Best regards
Ulrich Kulle
*************** *************** ********* http://www.help-info.de
*************** *************** ********* This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martijn Leine |
last post by:
I am using an errorprovider and a datagrid component on a
form. I use the errorprovider to display error hints in
the grid, in the case the entered data by the user is
checked and not found Ok.
After the data is corrected, the hint does not disappear !
(the exclamation mark however, does disappear).
For Microsoft:
If I'm correct, and it is a bug, can it be corrected ?
|
by: M O J O |
last post by:
Hi,
How do I check if an ErrorProvider has errors?
Take for example this code...
(err = ErrorProvider...)
Public Sub Test
If TextBox1.Text= "" Then
|
by: Issac |
last post by:
Hi,
I am writing a program which will be used in Win2000 and
Win98 platform. The program include a Form (called
myForm) which has a TextBox, Tooltip, Errorprovider and a
Button.
Tooltip will be set with TextBox content and Errorprovider
will be set in TextBox Validating event if it is empty.
The Button is actually pop (ShowDialog) itself (myForm).
|
by: Jeppe Jespersen |
last post by:
I read the following - regarding the ErrorProvider control - in the MOC
Course Material for course 2373:
"You can set your own error messages manually, as shown in the following
example, or when working with bound data, you set the DataSource propertyof
the ErrorProvider to automatically pick error messages up from thedatabase."
So, basically I want the ErrorProvider to automatically pick up database
errors, but have so far had no...
|
by: Lenster |
last post by:
I'm having problems using the errorprovider in VB.NET to automatically
display an error icon next to textboxes bound to the same dataset as the
errorprovider.
The sequence of events is :
Build a dataset containing a single table.
Bind the textboxes on a windows form to the datatable.
Bind the errorprovider control to the same datatable.
Use SetColumnError to create an error condition in the datatable.
| |
by: ljlevend |
last post by:
I have the following issues:
1. I want to make it so that ToolTips never go away once they are shown
until the user moves the mouse outside of the control for which the ToolTip
is assigned. It seems to me that setting the ToolTip.AutoPopDelay to a large
value (e.g., Int32.MaxValue) should acomplish this goal, but it does not.
2. I want to make it so that the ErrorProvider message is always displayed
when the mouse is over the...
|
by: Alvaro Lamas |
last post by:
I have a problem with the ErrorProvider with a mdi interface, I have a MDI
form which opens a child form, that child form uses the errorprovider to
show the problems with the data entry. The problem happens when I use the
show method of the child form it will try to validate the first field and
since it need to not empty and its just opening for the first time it fails
and the errorprovider shows an error icon, something that I obviously...
|
by: J L |
last post by:
I have a from with an ErrorProvider on it. I pass a reference of the
form to a subroutine where I want to reference the ErorrProvider. I
could pass it in the call to the subroutine, but I would like to
dreive it from the reference to the form that I am already passing.
Can this be done?
TIA
John
|
by: Freeon |
last post by:
How do I capture the hover event on the ErrorProvider control?
I created a custom control and inherited the ErrorProvider. Problem is
I don't know which method to override to capture the hover event. I
want to popup a custom form instead of the default tooltip.
Any help would be greatly appreciated.
Thanks,
Christian
|
by: Dad |
last post by:
Hi,
There does not appear to be anywhere for
ErrorProvider to
display its icon for ListView, ToolStrip, and
other other control
set with dockstyle fill, top, or bottom does not
leave space to the
sides for the icon. Is there a solution to using
these controls with
|
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: 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...
|
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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |