Results 1 to 4 of 4

Thread: [RESOLVED] casting timer object to System.Windows.forms

  1. #1

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Resolved [RESOLVED] casting timer object to System.Windows.forms

    Hi. I want to use a timer object from system.windows.forms. However, I also use threads, and I use the namespace: using System.Threading; Just that when I declare a timer object as:

    Timer updateTimer;

    I get an errro saying that it is ambigious. Is thhere some way to cast the Timer object to System.Windows.Form?

    Jennifer

  2. #2

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: casting timer object to System.Windows.forms

    Sorry guys. I found it out. I could miss silly mistake sometimes. Its

    System.Windows.Forms.Timer updateTimer;

    I'm still learning

    Jennifer

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: casting timer object to System.Windows.forms

    You can use a "using" directive to create an alias for namespace, to make it a little easier.

    Code:
    // in namespace
    using WinForms = System.Windows.Forms;
    
    // in class
    WinForms.Timer updateTimer;

  4. #4

    Thread Starter
    Hyperactive Member drattansingh's Avatar
    Join Date
    Sep 2005
    Posts
    395

    Re: casting timer object to System.Windows.forms

    Cool!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width