473,413 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Timer Array

Hi,

I'm trying to convert a VB ocx into a .NET dll. This dll ties into several
automated doors at our facility, and each door has a timer event attached
to it. When the user swipes his access card, he has a predetermined amount
of time (5 seconds) to open the door before the strike is re-enabled and
the door re-locks.

My problem is that I cannot declare an array of timers in .NET; I get the
error "'WithEvents' variables cannot be typed as arrays."

How would I work around this issue?

Regards,
Scott
Feb 26 '08 #1
3 2079
Scott McNair <sm*****@beachexpress.takethispartout.comwrote in
news:Xn**********************************@207.46.2 48.16:
My problem is that I cannot declare an array of timers in .NET; I get
the error "'WithEvents' variables cannot be typed as arrays."

How would I work around this issue?
Declare an array of timers, and then use AddHandler/RemoveHandler to
add/remove event registrations manually.

--
sp**********@rogers.com (Do not e-mail)
Feb 26 '08 #2
Spam Catcher <sp**********@rogers.comwrote in
news:Xn**********************************@127.0.0. 1:
What kind of timer are you using?

System.Timer?
System.Threading.Timer?
System.Window.Forms.Timer?
Just a generic System.Window.Forms.Timer for this instance.
Feb 26 '08 #3
Scott McNair <sm*****@beachexpress.takethispartout.comwrote in
news:Xn**********************************@207.46.2 48.16:
Spam Catcher <sp**********@rogers.comwrote in
news:Xn**********************************@127.0.0. 1:
>What kind of timer are you using?

System.Timer?
System.Threading.Timer?
System.Window.Forms.Timer?

Just a generic System.Window.Forms.Timer for this instance.
Since this is a background process, you should use System.Timer.Timer.

Forms.Timer uses the message pump... so if your app is under load, the
timers are not accurate.

More information here:

http://msdn.microsoft.com/msdnmag/is...2/TimersinNET/

--
sp**********@rogers.com (Do not e-mail)
Feb 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lloyd Sheen | last post by:
I have a problem where I cannot read (all the time) a file when caught by the FileSystemWatcher. What I have done to get past this is create an array of events (when I receive one I add it to the...
1
by: Paul Tomlinson | last post by:
Question about a System.Threading.Timer object and the "state" object you pass to it... Timer stateTimer = new Timer( = new TimerCallback( OnTimer ), o, 1000, 1000); I have an array of timer...
6
by: eBob.com | last post by:
My VB.Net app will require a timer of some sort. So I did some research and decided to use System.Windows.Forms.Timer, I guess mainly because while I have practically no experience with Events, I...
0
by: qiangdi_he | last post by:
Hi, Pals, I am using WaitAny( ) to wait for the events triggered by a timer. But it seems like that when the timer's interval elapsed, and the event was set, but WaitAny is still waiting there....
3
by: Gordon | last post by:
Hi; I am trying to give my CPU some relief from comparing a group of values to now() while looping through an array. I tried using the windows.system.timer but i have been unable to find the...
12
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...
4
by: Max | last post by:
This may be an elementary question but it's something I have not encountered in about 10 years writing code in VB 5 / 6 I have a timer that using the API checks if there has been a change to one...
2
by: Gina_Marano | last post by:
Good day, I read 1-n records from a database, For each record in the database I create a system timer. (then add the timer to a list of timers). I create an object to store the data for each...
16
by: Peter Oliphant | last post by:
Note that although this involves SAPI, it is more a question about Timers and event handlers. I wrote a Speech Recognize handler (SAPI), and put some code in it to enable a Timer. It would not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.