PACCAST-DEV
asked on
Validation problems when users blank out a textbox bound to a number field in vb.net windows app.
In my VS 2008 vb.net project I have some textboxes bound to number fields in the DB. when the user enters a number, then blanks out the number and moves off the textbox and tries to save the record it fails because it trys to save an empty string in the record.
How can I best handle this?
thanks,
bmutch
How can I best handle this?
thanks,
bmutch
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, I do allow nulls in these number fields.
Dhaest: - I have to declare this binding variable for every (about 10) field I want to take care of in this manner?
Dhaest: - I have to declare this binding variable for every (about 10) field I want to take care of in this manner?
ASKER
where does this line go:
aBinding .Parse +=new ConvertEventHandler(Parse_ Handler);
and this line gives error:
If e.Value.[GetType]() = Type.[GetType]("System.Str ing") Then
error : operator = is not defined for types system.type...
aBinding .Parse +=new ConvertEventHandler(Parse_
and this line gives error:
If e.Value.[GetType]() = Type.[GetType]("System.Str
error : operator = is not defined for types system.type...
ASKER
looks like I got it working, lot of hassle to just take care of the empty textbox...
ASKER
I used a variation of the "Binding" method above. Am dissappointed that this is so hard to do in VS...
Generally I handle this through the LostFocus event. I check if the value is valid and if not don't let them leave the textbox until they put a valid value in it.
mlmcc