Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I
know how to use it on a form, but I don't know how to "put" a timer in a
class (DLL)
Thx !!! 14 1476
Mathieu,
You can use this code in your class:
---------------------------
Private Withevents mTimer as New System.Windows.Forms.Timer
Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles
mTimer.Tick
' Handle the timer tick
End Sub
---------------------------
You'll need to add code to your class to enable/disable the timer.
I suggest you have a look at the other timers (System.Timers.Timer and
System.Threading.Timer) as they provide a little bit more functionality than
the Windows Forms timer, but need a little bit of care when using with
windows forms as their events can be raised on different threads.
Hope this helps,
Trev.
"Mathieu" <ma*************@videotron.ca> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Mathieu,
You can use this code in your class:
---------------------------
Private Withevents mTimer as New System.Windows.Forms.Timer
Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles
mTimer.Tick
' Handle the timer tick
End Sub
---------------------------
You'll need to add code to your class to enable/disable the timer.
I suggest you have a look at the other timers (System.Timers.Timer and
System.Threading.Timer) as they provide a little bit more functionality than
the Windows Forms timer, but need a little bit of care when using with
windows forms as their events can be raised on different threads.
Hope this helps,
Trev.
"Mathieu" <ma*************@videotron.ca> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Mathieu,
In addition to Armin's suggestion of how to do it.
Remember that to use System.Windows.Forms.Timer your application will need
the "message loop" running, which means it needs to have at least one form
running or you called System.Windows.Forms.Application.Run in your Sub Main.
If you are not otherwise using Windows Forms in your application you may
want to consider either the System.Threading.Timer class or the
System.Timers.Timer class.
Being a DLL it is hard to ensure that the main application will call
Application.Run!
Hope this helps
Jay
"Mathieu" <ma*************@videotron.ca> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Mathieu,
In addition to Armin's suggestion of how to do it.
Remember that to use System.Windows.Forms.Timer your application will need
the "message loop" running, which means it needs to have at least one form
running or you called System.Windows.Forms.Application.Run in your Sub Main.
If you are not otherwise using Windows Forms in your application you may
want to consider either the System.Threading.Timer class or the
System.Timers.Timer class.
Being a DLL it is hard to ensure that the main application will call
Application.Run!
Hope this helps
Jay
"Mathieu" <ma*************@videotron.ca> wrote in message
news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Thx All
I will use System.Timers.Timer !!!
"Codemonkey" <hu*********@hotmail.com> wrote in message
news:u5**************@TK2MSFTNGP12.phx.gbl... Mathieu,
You can use this code in your class:
--------------------------- Private Withevents mTimer as New System.Windows.Forms.Timer
Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles mTimer.Tick ' Handle the timer tick End Sub ---------------------------
You'll need to add code to your class to enable/disable the timer.
I suggest you have a look at the other timers (System.Timers.Timer and System.Threading.Timer) as they provide a little bit more functionality
than the Windows Forms timer, but need a little bit of care when using with windows forms as their events can be raised on different threads.
Hope this helps,
Trev.
"Mathieu" <ma*************@videotron.ca> wrote in message news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Thx All
I will use System.Timers.Timer !!!
"Codemonkey" <hu*********@hotmail.com> wrote in message
news:u5**************@TK2MSFTNGP12.phx.gbl... Mathieu,
You can use this code in your class:
--------------------------- Private Withevents mTimer as New System.Windows.Forms.Timer
Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles mTimer.Tick ' Handle the timer tick End Sub ---------------------------
You'll need to add code to your class to enable/disable the timer.
I suggest you have a look at the other timers (System.Timers.Timer and System.Threading.Timer) as they provide a little bit more functionality
than the Windows Forms timer, but need a little bit of care when using with windows forms as their events can be raised on different threads.
Hope this helps,
Trev.
"Mathieu" <ma*************@videotron.ca> wrote in message news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL)
Thx !!!
Hi Mathieu
In addition to all others
Try a time this, make a new program with only a timer from the toolbox on
it,
set the properties and open your code.
Look now at the code in Windows designer code (you can open that by pushing
the +)
That is the same as you can make and use on every form.
Than delete it and drag from the component box a timer (that is the
system.timers.timer) and try the same. That one you can use as far as I know
in any class.
But I have the same question as Armin, why would you make from this your own
DLL.
Or do you want to make your own Seiko's
I hope this helps,
Cor
Hi Mathieu
In addition to all others
Try a time this, make a new program with only a timer from the toolbox on
it,
set the properties and open your code.
Look now at the code in Windows designer code (you can open that by pushing
the +)
That is the same as you can make and use on every form.
Than delete it and drag from the component box a timer (that is the
system.timers.timer) and try the same. That one you can use as far as I know
in any class.
But I have the same question as Armin, why would you make from this your own
DLL.
Or do you want to make your own Seiko's
I hope this helps,
Cor
I need a Timer in my class because I need a "Timeout Connection".
Thx !!!
"Cor" <no*@non.com> wrote in message
news:uq**************@TK2MSFTNGP11.phx.gbl... Hi Mathieu
In addition to all others
Try a time this, make a new program with only a timer from the toolbox on it, set the properties and open your code.
Look now at the code in Windows designer code (you can open that by
pushing the +)
That is the same as you can make and use on every form.
Than delete it and drag from the component box a timer (that is the system.timers.timer) and try the same. That one you can use as far as I
know in any class.
But I have the same question as Armin, why would you make from this your
own DLL. Or do you want to make your own Seiko's
I hope this helps,
Cor
I need a Timer in my class because I need a "Timeout Connection".
Thx !!!
"Cor" <no*@non.com> wrote in message
news:uq**************@TK2MSFTNGP11.phx.gbl... Hi Mathieu
In addition to all others
Try a time this, make a new program with only a timer from the toolbox on it, set the properties and open your code.
Look now at the code in Windows designer code (you can open that by
pushing the +)
That is the same as you can make and use on every form.
Than delete it and drag from the component box a timer (that is the system.timers.timer) and try the same. That one you can use as far as I
know in any class.
But I have the same question as Armin, why would you make from this your
own DLL. Or do you want to make your own Seiko's
I hope this helps,
Cor
Just be careful if you are using the System.Timers.Timer timer when you are
dealing with Windows forms. Always be sure to call the Invoke() method of
the form if you want to call any other method on the form.
Trev
"Mathieu" <ma*************@videotron.ca> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Thx All I will use System.Timers.Timer !!!
"Codemonkey" <hu*********@hotmail.com> wrote in message news:u5**************@TK2MSFTNGP12.phx.gbl... Mathieu,
You can use this code in your class:
--------------------------- Private Withevents mTimer as New System.Windows.Forms.Timer
Private Sub TimerTickedHandler(sender as object, e as EventArgs) handles mTimer.Tick ' Handle the timer tick End Sub ---------------------------
You'll need to add code to your class to enable/disable the timer.
I suggest you have a look at the other timers (System.Timers.Timer and System.Threading.Timer) as they provide a little bit more functionality than the Windows Forms timer, but need a little bit of care when using with windows forms as their events can be raised on different threads.
Hope this helps,
Trev.
"Mathieu" <ma*************@videotron.ca> wrote in message news:ej**************@TK2MSFTNGP10.phx.gbl... Hi all,
I just want to know how to use a System.Windows.Forms.Timer in class.
I know how to use it on a form, but I don't know how to "put" a timer in
a class (DLL)
Thx !!!
I've used CCRP Timer and think it's brilliant for VB6 applications. Although
it can be used in DotNet via COM interop, there really isn't any need to use
it because of the System.Timers.Timer and System.Threading.Timer classes
which are better suited to the multithreaded-capable dotnet world.
Just my humble opinion.
Trev.
"avillela" <av******@cpqd.com.br> wrote in message
news:uo**************@TK2MSFTNGP11.phx.gbl... there's a timer that can be used into a class. it's a High Performance
Timer Object called CCRP.
you hate to make a reference to the object.
then
declare: Private WithEvents TimerTX As ccrpTimer
instance: Set TimerTX = New ccrpTimer
define the interval: TimerTX.Interval = 500 (mls)
to activate the timer: TimerTX.Enabled = True
after make a reference Private Sub TimerTX_Timer(ByVal Milliseconds As Long) your code End Sub
that's all
André-Brazil
"Mathieu" <ma*************@videotron.ca> escreveu na mensagem news:uO**************@TK2MSFTNGP09.phx.gbl... I need a Timer in my class because I need a "Timeout Connection". Thx !!! "Cor" <no*@non.com> wrote in message news:uq**************@TK2MSFTNGP11.phx.gbl... Hi Mathieu
In addition to all others
Try a time this, make a new program with only a timer from the toolbox on it, set the properties and open your code.
Look now at the code in Windows designer code (you can open that by pushing the +)
That is the same as you can make and use on every form.
Than delete it and drag from the component box a timer (that is the system.timers.timer) and try the same. That one you can use as far as
I know in any class.
But I have the same question as Armin, why would you make from this
your own DLL. Or do you want to make your own Seiko's
I hope this helps,
Cor
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bilo |
last post by:
I have a Windows Forms Class MainGUI
I have declared
MainGUI maingui;
public System.ComponentModel.Container components = new Container();
in the Class
I call another class MediaDriver with...
|
by: Chris Millar |
last post by:
I have a user control that i wish to extend to change the date when the user
selects the numeric up down button.
The code explains itself, hope someone can help.
any ideas appreaciated..
...
|
by: Alfonso Morra |
last post by:
Hi,
I am writing a timer class that I want to be able to get to notify me
(via a callback func), when a specified interval has elapsed. I have
most of the timer functionality figured - however,...
|
by: John David Thornton |
last post by:
I've got a Windows Service class, and I put a System.Threading.Timer, and
I've coded it as shown below. However, when I install the service and then
start it in MMC, I get a peculiar message:
...
|
by: Liverpool fan |
last post by:
I have a windows application written using VB .NET that encompasses a
countdown timer modal dialog. The timer is a System.Timers.Timer with
an interval of 1 second. AutoReset is not set so accepts...
|
by: Daniel |
last post by:
Hey guys
Here is what i want to do. I have made a multiplayer game that needs to when
more than one player is ready start a countdown that the clients can see,
so players can still join in this...
|
by: muzilli |
last post by:
Howdy all,
I would like to know how can I insert a Timer object in my class
library?
This timer object will start and stop in a determinated part or event
of my program.
I know how to do...
|
by: Gina_Marano |
last post by:
I have created an array of timers (1-n). At first I just created
windows form timers but I read that system timers are better for
background work. The timers will just be monitoring different...
|
by: Tony Gravagno |
last post by:
I have a class that instantiates two Timer objects that fire at
different intervals. My class can be instantiated within a Windows
Form or from a Windows Service. Actions performed by one of the...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |