المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Data Validation



C# Programming
04-24-2009, 08:00 AM
I'm a new user of c# and Visual Studios 2005 and am having some difficulty with data validation. I have discovered a couple of twist that I can't seem to get a handle on. I have created a form and dropped in fields from a data source (SQL), that of course auto generates your standard set of buttons to control forward, back, save, add, etc. I've added validation to the fields\cells and that is working fine, well kinda. All my data fields except one do not allow null. That may have been a bad decision, we'll see how the response goes. In any event, there are a couple of things I'd like to do, but have been unable to find answers on how to do this.

#1, If I'm sitting on a field other than the first field and then move to next or previous, I'd like my focus to change to the first field when I move. I tried adding a validated method to the > (next button), but nothing happens there. So where would I put it?

#2 If I press the add button, then decide to go back without deleting the record first, it throws me out of the form with an attempt to add a null value to a non-nullable cell error. So how and where do I catch this?

thanks, kb