471,355 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,355 software developers and data experts.

Custom control "invalid property value" dialog

Hi, ive written a custom control and i would like to display the
"invalid property value" dialog box for certain properties on my form if
the user enters a value outside the allowed range (in the visual studio
designer).
e.g. If i had a percentage property, i would want the user only to be
able to enter Int32 values between 0&100. How can i do this?
Jan 18 '06 #1
5 2599
Have you tried throwing an ArgumentException in your property setter?

Mar
Jan 18 '06 #2
Mark,

If your property throw an exception the designer will show the Invalid
property value withe the exception message.
--

Stoitcho Goutsev (100)

"Mark Ingram" <no****@nowhere.com> wrote in message
news:es**************@TK2MSFTNGP10.phx.gbl...
Hi, ive written a custom control and i would like to display the "invalid
property value" dialog box for certain properties on my form if the user
enters a value outside the allowed range (in the visual studio designer).
e.g. If i had a percentage property, i would want the user only to be able
to enter Int32 values between 0&100. How can i do this?

Jan 18 '06 #3
Stoitcho Goutsev (100) wrote:
Mark,

If your property throw an exception the designer will show the Invalid
property value withe the exception message.

which exception? ArgumentException?
Jan 18 '06 #4
Stoitcho Goutsev (100) wrote:
Mark,

If your property throw an exception the designer will show the Invalid
property value withe the exception message.


Throwing an Exception and ArgumentException both worked great, thanks!
Jan 18 '06 #5
Doesn't matter what kind of exception you throws, whatever make sense in you
case.

--

Stoitcho Goutsev (100)

"Mark Ingram" <no****@nowhere.com> wrote in message
news:uZ*************@TK2MSFTNGP10.phx.gbl...
Stoitcho Goutsev (100) wrote:
Mark,

If your property throw an exception the designer will show the Invalid
property value withe the exception message.


Throwing an Exception and ArgumentException both worked great, thanks!

Jan 18 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Eldon Ferran de Pol | last post: by
2 posts views Thread by R.A.F. | last post: by

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.