Visual Studio is not recognizing the .Elapsed method

Posted on 2006-03-22
Medium Priority
Last Modified: 2010-04-23
Visual Studio is not recognizing the .Elapsed method for Timer - "Timer1".   Any idea why?

I have a timer named Timer1

When I created the Timer1.. I draged it from the Toolbox under in the Components Tab which uses the timer from System.Timers.Timer (I supossed)....but when i see the properties appears "Timer1 System.Windows.Forms.Timer "..... i'm trying to create a windows service!!!!!!!
Question by:marianatagliaferro
LVL 96

Accepted Solution

Bob Learned earned 672 total points
ID: 16257744
There are 3 different types of timers, which one do you need, and which one do you have?

LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 664 total points
ID: 16257829
Elapsed is an Event not a Method.
LVL 41

Assisted Solution

graye earned 664 total points
ID: 16257870
Yeah, the "drag and drop" feature of the IDE for components is really designed for windows form applications.   It will make the assumption that you're coding a WinForm app and add the System.Windows.Forms underpinning.

So don't do that! :)

Instead you should "manually" create the timer in code.   It's not at all difficult.... you just instantiate a Timer class.   As TheLearnedOne has pointed out, there are 3 Timer classes, (System.Threading.Timer, System.Timers.Timer, and System.WIndows.Forms.Timer).   More than likely the the one you want is System.Timers, since it has the .Elapsed event (not method!).

Something like:

Dim Timer1 as New System.Timers.Timer



Author Comment

ID: 16269328
Thank you...!!!!!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

755 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question