views:

40

answers:

3

I think I want to show some kind of confirmation tick type thing by a textbox - (it's traditional windows forms stuff, not WPF) - but not sure if it's a bit naff. I would like some kind of slick way of showing that a value is incorrect or valid after some tests have been done i.e. a web service is valid with that name or SMTP server seems to running with that name etc.

Should there be even any visual stuff going on or should a simple message on a status strip at the bottom of the window be enough.....

Any ideas are most welcome. PS - if the tick thing is a good idea what's the best way to implement this with a textbox control.

Example....

alt text

+1  A: 

You can use ErrorProvider to show a little exclamation mark when the entered value is incorrect.

Henrik
yep - had a look at that, but it's errors only. Maybe it's enough...
Vidar
I would suggest going with this method (the error providers) if possible because it require the least amount of code and maintenance, though I think the idea of a visual confirmation that something is correct could be a legitimate requirement. I see it on websites all the time when they use Ajax to determine if a field is correct (such as if a zip code exists, etc...).
wllmsaccnt
+2  A: 

You could make a custom control which contains both a textbox and an imagebox. The custom control could raise a validation event which checks the text and then sets the imagebox graphic based on whether or not the validation passed (or sets it blank if there is not text in the textbox).

The .net centric way would probably be to implement validation providers and some type of custom error provider, like what Henrik is mentioning.

wllmsaccnt
+1  A: 

Hi, you can use the ErrorProviderComponent in order to show notifications. The naming of that component is slightly unfortunate in my mind but you can easily change the icon to show other things than the typical red error "X".

Mikael
"Out of the box" it only displays when there are validation errors though doesn't it?
wllmsaccnt
Well, you can always set it whenever you want. However, as I said I don't really think it is a brilliant choice as it called “Error”Provider and is intended to visualize error states. But you can easily place them whenever you like and just have another icon, for example the exclamation mark or a “check” as in a checkbox. 'ErrorProvider p = new ErrorProvider(); p.SetError(comboBox1, "Value has been validated and is correct!");'
Mikael