System.Timers
5 posts
• Page 1 of 1
System.Timers
Hello!
What's the error?
- Code: Select all
private function tmr(\System\Object $sender, \System\Timers\ElapsedEventArgs $e)
{
$this->richTextBox1->Text .= "test\r\n";
}
private function button1_Click(\System\Object $sender, \System\EventArgs $e) {
$tim = new \System\Timers\Timer();
$tim->Elapsed += new \System\Timers\ElapsedEventHandler($this->tmr);
$tim->Interval = 1000;
$tim->Start();
}
What's the error?
- z668
- Posts: 6
- Joined: March 25th, 2013, 9:38 pm
Re: System.Timers
What does it say in your Errors Window, or Output Window?
Thanks
Thanks
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: System.Timers
Jakub Misek wrote:What does it say in your Errors Window, or Output Window?
Thanks
Cannot write to event System\Timers\Timer::$Elapsed, use System\Timers\Timer::$Elapsed->Add() and System\Timers\Timer::$Elapsed->Remove() to add or remove an event handler
or
- Code: Select all
$tim = new \System\Timers\Timer();
$tim->$Elapsed->Add($this->tmr);
$tim->Interval = 1000;
$tim->Start();
Call to a member function Add() on a non-object
or
- Code: Select all
$tim = new \System\Timers\Timer();
$tim::$Elapsed->Add($this->tmr);
$tim->Interval = 1000;
$tim->Start();
Access to undeclared static property: System\Timers\Timer::$Elapsed
- z668
- Posts: 6
- Joined: March 25th, 2013, 9:38 pm
Re: System.Timers
"$tim::$Elapsed" means access to static property Elapsed on class name {$tim}.
Use "$tim::Elapsed" instead. That should fix your problem.
Thanks,
Use "$tim::Elapsed" instead. That should fix your problem.
Thanks,
Jakub Misek │ DEVSENSE s.r.o. | @misekjakub │ jakub@devsense.com │
-
Jakub Misek - Posts: 2092
- Joined: January 4th, 2012, 2:42 pm
- Location: Prague
Re: System.Timers
Jakub Misek wrote:"$tim::$Elapsed" means access to static property Elapsed on class name {$tim}.
Use "$tim::Elapsed" instead. That should fix your problem.
Thanks,
Thank you!
- z668
- Posts: 6
- Joined: March 25th, 2013, 9:38 pm
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests