Results 1 to 3 of 3

Thread: how to calculate date in vb.net

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2008
    Posts
    103

    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........

  2. #2
    New Member
    Join Date
    May 2010
    Posts
    1

    Re: how to calculate date in vb.net

    cdate(masktxtdepostdate).AddMonths(13)

  3. #3
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    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.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width