By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,732 Members | 842 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,732 IT Pros & Developers. It's quick & easy.

ErrorProviders - Icon Change at Run-Time

P: n/a

My user interface design requires that ErrorProviders are used for errors
but also to indicate warnings to the users as well. In order to provide a
clear visual clue between errors and warnings its necessary to have two
differing icons.

I could place two ErrorProviders on my form, but what I would really like to
do is switch the Icon on the ErrorProvider control at run-time. But I am
having difficulty in understanding the syntax required to point the
ErrorProvider icon property at an Icon embedded inside the project assembly.

Does anybody have an suggestions on the syntax required to achieve this?

Many thanks

Steve Le Monnier

Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Steve Le Monnier wrote:

My user interface design requires that ErrorProviders are used for errors
but also to indicate warnings to the users as well. In order to provide a
clear visual clue between errors and warnings its necessary to have two
differing icons.

I could place two ErrorProviders on my form, but what I would really like
to do is switch the Icon on the ErrorProvider control at run-time. But I
am having difficulty in understanding the syntax required to point the
ErrorProvider icon property at an Icon embedded inside the project
assembly.

Does anybody have an suggestions on the syntax required to achieve this?


This MS knowledge base article should have all the information you need:
http://support.microsoft.com/Default.aspx?id=319292

However, I have done the same thing in the past and I've found it more
practicable to use two different error providers - not so much switching
code, and the code is easier to understand because it's plain to see what
provider is used in a specific error/warning situation.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Nov 17 '05 #2

P: n/a
Thanks for the advice Oliver I will do some additional tests before deciding
what to do.

FYI: My post was a simplification of what I am trying to achieve. I'm not
dragging the ErrorProviders onto a form I am actually embedding them
directly inside my own TextBox control, that's the reason why I don't want
to overload the control with four versions of the error provider when I know
only one can ever be active at any one time.

By having ErrorProviders built into a textbox control I can centralise some
of the standard data validation I do on every single project I work on. This
should allow me to reduce the amount of form validation code I end up
writing.

Cheers

Steve Le Monnier

"Oliver Sturm" <ol****@sturmnet.org> wrote in message
news:xn****************@msnews.microsoft.com...
Steve Le Monnier wrote:

My user interface design requires that ErrorProviders are used for errors
but also to indicate warnings to the users as well. In order to provide a
clear visual clue between errors and warnings its necessary to have two
differing icons.

I could place two ErrorProviders on my form, but what I would really like
to do is switch the Icon on the ErrorProvider control at run-time. But I
am having difficulty in understanding the syntax required to point the
ErrorProvider icon property at an Icon embedded inside the project
assembly.

Does anybody have an suggestions on the syntax required to achieve this?


This MS knowledge base article should have all the information you need:
http://support.microsoft.com/Default.aspx?id=319292

However, I have done the same thing in the past and I've found it more
practicable to use two different error providers - not so much switching
code, and the code is easier to understand because it's plain to see what
provider is used in a specific error/warning situation.
Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.