i'm having problems following: have 2 textboxes masked shortdate
. when insert date 1st textbox need 2nd textbox display date 2 years later.
for example, if put 10/08/2013 2nd box should show 10/08/2014.
here code:
private sub txtacquired_lostfocus(sender object, e eventargs) handles txtacquired.lostfocus dim acquired date acquired = txtacquired.text txtdisposal.text = acquired.addyears(2) end sub
it works fine when day value of date > 9 when put date day value between 1 , 9 not work, e.g. if put 04/04/2011 2nd box shows 40/42/013_.
if can on problem appreciated.
there fault date returned. fixes it.
private sub txtacquired_lostfocus(sender object, e eventargs) handles txtacquired.lostfocus dim acquired date if date.tryparse(txtacquired.text, acquired) txtdisposal.text = acquired.addyears(2).tostring("mm/dd/yyyy") end if end sub