Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Start actions based on a certain Time

Status
Not open for further replies.

readyyy

Technical User
Jan 24, 2005
29
CH
Hello

I have 2 For loops:

Dim i as integer
Dim j as integer

For i = 1 to 366

' perform code action

Next

For j = 1 to 333

' perform code action

Next

I need to start the first for loop exactly at 14.00 PM.

The j loop should start at 03:00 AM in the morning. How can i do that? Maybe there is the possibility to read the system time from the computer or something?
 
you drag a timer on to your form and set the interval to 1000 milliseconds then you double click on it and in that area you write this

declare a private variable somewhere in a general declaration area

like this

dim bolforteen as boolean = false
dim bolthree as boolean = false

Code:
if now().hour() = 14 then
  if bolforteen = false then
    'do something
  end if
  bolforteen = true
else
  bolforteen = false
end if
if now().hour() = 3 then
  if bolthree = false then
    'do something
  end if
  bolthree = true
else
  bolthree = false
end if


Christiaan Baes
Belgium

"My new site" - Me
 
Magic word: "Service".
* The loops could be two different console applications. Start them by system.diagnostics.process.start(...).

Hope this helps.
 
How bout just creating two apps and then using Windows Scheduler to kick them off????
 
My preference is like TipGiver said, set up a service that monitors the time and pulls execution schedules from a database then launches the appropriate module at the correct time.

But if you are looking for a quick and easy way, go with Macleod's idea. Make 2 applications and set up the Windows Scheduler to run them, it is a great tool.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top