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. How to store the system clock in a variable

How to store the system clock in a variable

Scheduled Pinned Locked Moved Visual Basic
helptutorial
4 Posts 3 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
    Neo_Ali
    wrote on last edited by
    #1

    Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali

    K D 2 Replies Last reply
    0
    • N Neo_Ali

      Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali

      K Offline
      K Offline
      Kanniah
      wrote on last edited by
      #2

      Hi You have got it wrong! Declare a Public variable something like Public MyHalfAnHour as Integer If you have set the timer control as 1 minute. Keep incrementing the above variable in the timer control event and when the incremented value is 30, it means that 30 hour has lapsed and close the application else leave the application as it is. 2. When the user clicks the end button on the second form initialize the variable. I hope it helps!!! Kanniah

      N 1 Reply Last reply
      0
      • N Neo_Ali

        Please i want your help with a code which i can use to store the system clock in a variable which i can use to add a 30 mints to it. as i want to my application to be shutdown after 30 mints when i click Start button but if the user click End button in another form then the timing should stop , and using the timer control was not helpful becuase it dose not accept any compare condition and just close the application. so i thought to ignore the timer control and use a code which i can store the system clock in a variable and insert that varialbe in a loop and inside the loop i compare the variable with specific value, if it is the desired value then close the application else go again and read the system clock , DO u think its good thinking. if u think its applicale , please help me a code to store the system clock in a variable. please advise and thank u for ur help Ali

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3
        Dim StartTime As DateTime = DateTime.Now()
        

        Dave Kreskowiak Microsoft MVP - Visual Basic

        1 Reply Last reply
        0
        • K Kanniah

          Hi You have got it wrong! Declare a Public variable something like Public MyHalfAnHour as Integer If you have set the timer control as 1 minute. Keep incrementing the above variable in the timer control event and when the incremented value is 30, it means that 30 hour has lapsed and close the application else leave the application as it is. 2. When the user clicks the end button on the second form initialize the variable. I hope it helps!!! Kanniah

          N Offline
          N Offline
          Neo_Ali
          wrote on last edited by
          #4

          Thank you so much , this is really a very smart idea

          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