Paul Laudeman

Sponsors

The Lounge

News

  • I'm test-driven!
    TestDriven.NET

    MSN Messenger: plaudeman at hotmail dot com

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Learn to enhance the built-in Windows Forms validation controls

New MSDN arcticle: Extending Windows Forms with a Custom Validation Component Library

Summary: Data validation is a key step in ensuring clean data capture and subsequent processing and reporting. This installment explores the programmatic validation infrastructure native to Windows Forms and builds upon that foundation to develop a custom library of validation components designed to provide a more productive validation experience akin to using ASP.NET's validation controls.

UPDATED:

Part 2 is now available on MSDN: Extending Windows Forms with a Custom Validation Component Library, Part 2


Posted 04-11-2004 11:33 AM by paul.laudeman
Filed under:

[Advertisement]

Comments

Frans Bouma wrote re: Learn to enhance the built-in Windows Forms validation controls
on 04-11-2004 7:59 AM
Too bad that the Validation event of a textbox is fired AFTER the SelectedIndexChanged event is fired of the listview you clicked on while editing something in the textbox.
Paul Laudeman wrote re: Learn to enhance the built-in Windows Forms validation controls
on 04-11-2004 8:30 AM
Yes, weird! I hadn't noticed that before but it is very odd. It's times like these I wish I had the source for the Framework to see what is really going on!

A quick peek at the ListView through Lutz Roeder's Reflector however did reveal a lot of interesting behavior in the WndProc method of the control. Unfortunately it wouldn't decompile all the jumps so I couldn't tell exactly what was going on in the method.

I did notice, however, that the ListView will raise the "Enter" event before the "SelectedIndexChanged" event. Maybe you could hook up some custom processing in an "Enter" event handler? Chris Sells has an example of how to invoke the validation method of a control programatically through reflection. If you're interested, I can dig up a sample.
Mark Bonafe wrote re: Learn to enhance the built-in Windows Forms validation controls
on 04-12-2004 2:19 AM
Hey Paul, I'd be very interested in that example. Sometimes it'd be easier to fire the event than to setup a method that is basically doing the same thing.
Paul Laudeman's Blog wrote Programmatically invoking the Validating event on Windows Forms controls
on 04-12-2004 3:46 AM
Programmatically invoking the Validating event on Windows Forms controls
Paul Laudeman wrote re: Learn to enhance the built-in Windows Forms validation controls
on 04-12-2004 3:46 AM
Mark Kamoski wrote re: Learn to enhance the built-in Windows Forms validation controls
on 05-17-2005 6:35 AM
FYI, when the link above, "Extending Windows Forms with a Custom Validation Component Library, Part 2", is clicked, an error occurs saying "Location Cannot Be Found".

Add a Comment

(required)  
(optional)
(required)  
Remember Me?