Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Timed Button

So I want to make a button that presses at a time I set, so say I pick 11:00 AM EST, At the exact time the button presses how would i do this? Any video tutorials?
How about making use of the Windows Task Scheduler and have it run the code of your button event instead of actually simulating a button click?
Can you link me a video tutorial? Is there anyway to do it the way i described?
public class Timer1
{
private static System.Timers.Timer aTimer;

public static void Main()
{
// Create a timer with a ten second interval.
aTimer = new System.Timers.Timer(600000);

// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

// Set the Interval to x minutes
aTimer.Interval = 600000;
aTimer.Enabled = true;

Console.WriteLine("Press the Enter key to exit the program.");
Console.ReadLine();

// If the timer is declared in a long-running method, use
// KeepAlive to prevent garbage collection from occurring
// before the method ends.
GC.KeepAlive(aTimer);
}

// Specify what you want to happen when the Elapsed event is
// raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Butnupdate.Enabled = false;
MessageBox.Show("Time Up!");
}
}

example taken from microsoft
Code
If DateTime.Now.ToString = "What you want" Then
      Button1.PerformClick()
      End If
There you go
(Apr 10, 2015 09:34 AM)Coco_Cubana Wrote:  public class Timer1
{
private static System.Timers.Timer aTimer;

public static void Main()
{
// Create a timer with a ten second interval.
aTimer = new System.Timers.Timer(600000);

// Hook up the Elapsed event for the timer.
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

// Set the Interval to x minutes
aTimer.Interval = 600000;
aTimer.Enabled = true;

Console.WriteLine("Press the Enter key to exit the program.");
Console.ReadLine();

// If the timer is declared in a long-running method, use
// KeepAlive to prevent garbage collection from occurring
// before the method ends.
GC.KeepAlive(aTimer);
}

// Specify what you want to happen when the Elapsed event is
// raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Butnupdate.Enabled = false;
MessageBox.Show("Time Up!");
}
}

example taken from microsoft

This is java code.

As the user above me said that's one of the ways to do it. Just stick that in a timer that checks every few seconds (or less if you wanted)
(Apr 10, 2015 02:31 PM)VEX_solutions Wrote:  This is java code.

As the user above me said that's one of the ways to do it. Just stick that in a timer that checks every few seconds (or less if you wanted)

No, it's C# why else would it be posted in the .Net Framework Section?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by LeonieHackPetaBytes2Jan 23, 2019 05:10 PM 1 227 Jan 23, 2019 05:10 PM
Last Post: 0xDEAD10CC
[C] by theChiveFeb 2, 2016 07:20 PM 3 144 Feb 2, 2016 07:20 PM
Last Post: Annabelle Lee
[.NET] by ElementalTreeOct 28, 2014 05:48 PM 2 142 Oct 28, 2014 05:48 PM
Last Post: Hiiro