Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Calculating Date

Calculating Date

Scheduled Pinned Locked Moved Visual Basic
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nikhil Bandekar
    wrote on last edited by
    #1

    Hello, I am looking out for a logic to calculate the date according to the no. entered in the textbox. For e.g. as the form gets loaded in runtime it displays the current date in the date control, and there is one text box in which numeric value 5 is specified and the third part is their is one more date control on the same form which will add 5 days to the current date and display. For e.g. In first date control current date is displaying as 29/08/2006 In the textbox below numeric value 5 is specified by default. In second date control which is just below the textbox should display 03/09/2006 it has jumped to next month even does any body knows how it can be done, waiting for kind and quick response.

    Nikhil Bandekar Mumbai, India

    G 1 Reply Last reply
    0
    • N Nikhil Bandekar

      Hello, I am looking out for a logic to calculate the date according to the no. entered in the textbox. For e.g. as the form gets loaded in runtime it displays the current date in the date control, and there is one text box in which numeric value 5 is specified and the third part is their is one more date control on the same form which will add 5 days to the current date and display. For e.g. In first date control current date is displaying as 29/08/2006 In the textbox below numeric value 5 is specified by default. In second date control which is just below the textbox should display 03/09/2006 it has jumped to next month even does any body knows how it can be done, waiting for kind and quick response.

      Nikhil Bandekar Mumbai, India

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Use the AddDays method of the DateTime class to add a number of days to a date: DateControl2.DateProperty = DateControl1.DateProperty.AddDays(Int32.Parse(TextBox.Text))

      --- b { font-weight: normal; }

      N 1 Reply Last reply
      0
      • G Guffa

        Use the AddDays method of the DateTime class to add a number of days to a date: DateControl2.DateProperty = DateControl1.DateProperty.AddDays(Int32.Parse(TextBox.Text))

        --- b { font-weight: normal; }

        N Offline
        N Offline
        Nikhil Bandekar
        wrote on last edited by
        #3

        Thank you very much it works but i changed the code little bit by typing datecontrol.value instead of date property and it works fine Thanks a lot.

        Nikhil Bandekar Mumbai, India

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups