Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7015775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:41:48+00:00 2026-05-27T22:41:48+00:00

Hi I am working with Windows.Forms.Timer with Web Application . I create Timer.Tick event

  • 0

Hi I am working with Windows.Forms.Timer with Web Application . I create Timer.Tick event handler to handle Timer_Tick but I am not successfull. I don’t get any error but I can not get result even. Here is my code

     System.Windows.Forms.Timer StopWatchTimer = new System.Windows.Forms.Timer();
    Stopwatch sw = new Stopwatch();

public void StopwatchStartBtn_Click(object sender, ImageClickEventArgs e)
{
    StopWatchTimer.Enabled = true;
    StopWatchTimer.Interval = 1;
    StopWatchTimer.Start();
    this.StopWatchTimer.Tick += new EventHandler(StopWatchTimer1_Tick);
    sw.Start();
}


protected void StopWatchStopBtn_Click(object sender, ImageClickEventArgs e)
{
    StopWatchTimer.Stop();
    sw.Reset();
    StopWatchLbl.Text = "00:00:00:000";
}

public void StopWatchTimer1_Tick(object sender,EventArgs e)
{
    TimeSpan elapsed = sw.Elapsed;
    StopWatchLbl.Text = string.Format("{0:00}:{1:00}:{2:00}:{3:00}", 
                            Math.Floor(elapsed.TotalHours), 
                            elapsed.Minutes, 
                            elapsed.Seconds, 
                            elapsed.Milliseconds);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:41:49+00:00Added an answer on May 27, 2026 at 10:41 pm

    From the MSDN documentation for Windows Forms Timer (emphasis mine):

    Implements a timer that raises an event at user-defined intervals. This timer is optimized for use in Windows Forms applications and must be used in a window.

    This timer will not work in a web application. You’ll need to use another class, like System.Timers.Timer. This has it’s own pitfalls, however.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with Windows Forms, is it possible to create a window which
I'll start working on windows forms application that hosts ESRI maps into it So,
I'm working on a windows forms application (C#) where a user is entering data
I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception
I am working on a Windows Forms application in VS 2008, and I want
I am working on a Windows Forms application in C#/.Net. I want to use
I am working on a simple chat application using a System.Windows.Forms.WebBrowser Control to display
I'm working on a windows forms application (.NET 4.0). My form contains a 'Fast
I am working on a Windows Forms app for quite some time now, and
I've been working in windows forms applications and ASP.Net applications for the past 10

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.