views:

725

answers:

1

I have a Windows Forms application with a DataGridView in one of the forms. The DataGridView can insert and update through a Typed Data Set generated by Visual Studio.

I want to show user friendly error messages when a user doesnt fill in a required field or enters the wrong data type, etc. instead of the ugly huge one that is shown by default.

This page here gives some guidance. It advises me to validate input on my data sources property setters.

How can I do this with a typed dataset? I am used to working with Linq To Sql, which generated partial classes, but I am not sure about typed datasets.

Thanks.

A: 

In terms of winforms visual feedback, I think you should look at a concept like the ErrorProvider.

If you are only focusing on input validation, like a string into an integer field this is a good approach, but please, please be aware that real validation of non-trivial mistakes shouldn't be enforced by winform's control validation event model! For example, 'EndDate < StartDate', really should be pushed down into the business layer.

Noel Kennedy
This is trivial. Your link is messed up. I don't really understand your answer.
Ronnie Overby
Fixed the link,not sure what happened there. Does that help?
Noel Kennedy