Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2006

Tip: Looking for answers? Try searching our database.

ErrorProvider Property

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dwight - 21 Sep 2006 14:33 GMT
Hi,
I know how to set the message for an ErrorProvider through code when
handling a validating event, however, I would like to use the message
that is entered at design time in the properties window for a given
control. ie. Error or ErrorProvider1.  How can I use this message with
the seterror method?
Chris Dunaway - 21 Sep 2006 15:57 GMT
> Hi,
> I know how to set the message for an ErrorProvider through code when
> handling a validating event, however, I would like to use the message
> that is entered at design time in the properties window for a given
> control. ie. Error or ErrorProvider1.  How can I use this message with
> the seterror method?

Looking at the properties and methods of the ErrorProvider class in the
docs, I found the GetError method.  

Perhaps that is what you need?
Herfried K. Wagner [MVP] - 21 Sep 2006 23:32 GMT
"Chris Dunaway" <dunawayc@gmail.com> schrieb:
>> I know how to set the message for an ErrorProvider through code when
>> handling a validating event, however, I would like to use the message
[quoted text clipped - 6 lines]
>
> Perhaps that is what you need?

Note that this will only work if you have not reset/changed the assigned
text using 'SetError' previously.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

djmiller9975@hotmail.com - 29 Sep 2006 22:18 GMT
Do you have any suggestions on how to use this?  What is the purpose of
provding the property as design time?  In order to clear an error when
it happens, you have to set the error message for the control to ""
esentially changing the property.

Also, using the geterror method of the error provider doesn't return
anything until after you set the error.  Here's what I was hoping to
do;

Set one event handler for several textbox controls that cannot be left
blank and use the following code as part of the validating event:

       Dim ctrl As Control = DirectCast(sender, Control)
       If Len(ctrl.Text) = 0 Then
          ErrorProvider1.SetError(ctrl, ErrorProvider1.GetError(ctrl))
       Else
           ErrorProvider1.SetError(ctrl, "")
       End If

I was hoping this would use the Error on ErrorProvider1 property of the
corresponding control.

Any suggestions?

Thanks,

> "Chris Dunaway" <dunawayc@gmail.com> schrieb:
> >> I know how to set the message for an ErrorProvider through code when
[quoted text clipped - 15 lines]
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.