Visual Studio is not recognizing the .Elapsed method

Posted on 2006-03-22
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

    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
    Elapsed is an Event not a Method.
    LVL 41

    Assisted Solution

    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

    Thank you...!!!!!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    Article by: Kraeven
    Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now