how to calculate date in vb.net
hi i am developing a banking software in vb.net...
i have a two maskedtextbox, one textbox named as masktxtdepostdate and , masktxtmaturitydate, txtnoofmonth.
i changed maskedtextbox property as date, in format "YYYY-MM-DD";
now i need to calculate masktxtmaturitydate after entering the values in, masktxtdepostdate and txtnoofmonth.
calculation formula is
masktxtmaturitydate = masktxtdepostdate + txtnoofmonth
for example
masktxtdepostdate.text="2009-05-26" and txtnoofmonth.text= 13
after enering no of months in txtnoofmonth.text i need to calculate maturitydate as
masktxtmaturitydate.text="2010-06-26"
how can i code for this........
Re: how to calculate date in vb.net
cdate(masktxtdepostdate).AddMonths(13)
Re: how to calculate date in vb.net
I did not know you could set the mask of the masked textbox to YYYY-MM-DD and have it be meaningful. I thought you had to do 0000-00-00.
For your textbox with some number of months, look at Integer.TryParse.