Hi. I am validating some controls on a form using each control's validating property. If I need to raise an error, I set the error provider to that control with a message... How can I prevent actions from happening when the user presses a button (submit button for instance) if there is an error on the screen?

Also, how can I create a set of common functions so I do not have to duplicate code for required fields, or numeric fields, ect..

I am not talking about creating a control which acts as the asp.net validation fields, I am wanting to implement a more structured error handling logic, using iDataErrorProvider ect, but I am totally lost on how to implement.

A simple commonFunctions class would be nice, but again, I am very lost on how to do this..

Thanks,