More on Validation in WinForms

As I was looking over the validation controls in Genghis I kept thinking that the ValidationSummary control that we have in ASP.NET was missing.   Michael Weinhardt has a series of articles on MSDN from last year that overviews how to create a ValidationSummary for WinForms.  I’m wondering why this hasn’t been incorporated into Genghis?  Anyway the articles are here:

Extending Windows Forms with a Custom Validation Component
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms03162004.asp

Extending Windows Forms with a Custom Validation Component, Part II
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms04202004.asp

Extending Windows Forms with a Custom Validation Component, Part III
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms05182004.asp

# re: More on Validation in WinForms

Wednesday, July 27, 2005 4:32 PM by Ron Green    
Steve,
What behavior are you looking for from "ValidationSummary"?
You can set the validation events to fire when submit is pressed instead of firing as the user leaves the control(s).

# re: More on Validation in WinForms

Wednesday, July 27, 2005 4:44 PM by Steve    
Checkout the valiation summary control in the 3rd article to see the type of things I'm looking for. Basically an equivalent to what's in ASP.NET...the ability to show a list of all the validation errors for a form. I don't want to have to muck together a big long string myself. I want to use controls like the RequiredFieldValidator and etc that are available in Genghis (or preferably one's built into .NET if we can ever get them), and have a summary control that can take all the validation errors that are triggered by the individual validation controls and summarize them into a single message that overviews all errors to the user. After getting all their errors the visual clues in the UI (!) will provide them additional guidance on how to correct the problems.

# re: More on Validation in WinForms

Wednesday, July 27, 2005 11:47 PM by Ron Green    
But wouldn't that be a little redundant? In ASP.net you either get the summary or get validation on exit from each control. With this, you can get validation on submit for all controls, with a visual identifier for each invald control. I guess i don't see any added advantage to also having a messagebox pop up with a list of invalid controls. With ASP.net, there is no visual clue other than the messagebox.

# re: More on Validation in WinForms

Thursday, July 28, 2005 8:57 AM by Steve    
The behavior of the ASP.NET controls depends a large part on how you set them up. The way I've always used them is to set the Text properly to "*", and the error message to the appropriate descriptive text for the error. When the user tries to submit the form they get a red "*" next to invalid fields as well as a summary in the "list" (either message box or on the page). Obviously this is all personal preference, but I like to show the user an indicator of what field is invalid as well as give them one nice summary of all the errors. That way they know exactly what they need to fix, as well as gain some insight into what they need to do to fix the invalid entries. By just having the visual indicator you force the user to mouse over each one to see what the error is, which works, but, doesn't seem that user friendly to me. Like I said, just my .02 on the topic.

Post a Comment

 
 
Prove you're not a spammer: 
4 + 4 =