.net - issues with text box value changes -
i have textbox, situation when user leaves empty, ok button disabled. if user types in value of duration based on days, button gets enabled.
the problem is: let's user clicks on text box, types in : 100, , realizes made mistake, erase value , tries start filling other textboxes , come again afterwards, @ level @ time user clicks on other part of form, value becoems 0 autoamtically , ok button enabled now.
how can avoid this?
private sub txtmembershipduration_textchanged(byval sender system.object, byval e system.eventargs) handles txtmembershipduration.textchanged if txtmembershipduration.text = "" btnok.enabled = false end if end sub
also, how can control auttomatic 0?
use tryparse
on check, , make sure it's greater 0, instead of checking if it's "". link: tryparse
Comments
Post a Comment