jonnycab

I've built a form using the drag and drop method from a dataset. Great, so now I have a form that I can add, edit, and delete details but how do I create field validation to

a) Prevent the errors generated from the datatable constraints (No Nulls)

b) Put in my own validation like making sure if one tick box is ticked that certain fields are completed

I want to validate fields before the user moves to another record (new or existing) or when a user clicks on the save button to save the datatable changes. Ideally validation would only occur if the row of data has changes or is a new row.

Any help on this would be appreciated.



Re: Windows Forms Data Controls and Databinding Best method to Validate windows form field data bound to a dataset datatable?

William Ryan

Well, you always want to validate at the db level b/c it's the final fail safe. At the UI level, you want to validate at the control level so that you can disable buttons and stuff. You can do that with each control's respective events. You can also trap ONRowChanging and OnColumnChanging which should give you what you are looking for.

HTH,

Bill






Re: Windows Forms Data Controls and Databinding Best method to Validate windows form field data bound to a dataset datatable?

jonnycab

Thanks for that Bill. Did a search over previous posts and found some good links to articles on validation. These give some detail of the methods you have mentioned.

Cheers

Jonny