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 8890453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:30:20+00:00 2026-06-14T22:30:20+00:00

After a button is clicked in a Windows form application written in C#, how

  • 0

After a button is clicked in a Windows form application written in C#, how to wait for another button to be clicked? Meanwhile I am updating a datagridview dynamically by current information.

EDIT

After button1 is clicked, I want to repeatedly update a dataGridView with current information and when button2 is clicked I want to stop updating the dataGridView.

  • 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-06-14T22:30:21+00:00Added an answer on June 14, 2026 at 10:30 pm

    Use Timer Class.

    public partial class Form1 : Form
    {
        System.Windows.Forms.Timer timer;
    
        public Form1()
        {
            InitializeComponent();
    
            //create it
            timer = new Timer(); 
            // set the interval, so it'll fire every 1 sec. (1000 ms)
            timer.Interval = 1000; 
            // bind an event handler
            timer.Tick += new EventHandler(timer_Tick); 
    
            //...
        }
    
        void timer_Tick(object sender, EventArgs e)
        {
            //do what you need
        }
    
        private void button1_Click(object sender, EventArgs e)
        {
            timer.Start(); //start the timer
            // switch buttons
            button1.Enabled = false;
            button2.Enabled = true;        
        }
    
        private void button2_Click(object sender, EventArgs e)
        {
            timer.Stop(); //stop the timer
            // switch buttons back
            button1.Enabled = true;
            button2.Enabled = false;
        }
    

    From MSDN:

    A Timer is used to raise an event at user-defined intervals. This
    Windows timer is designed for a single-threaded environment where UI
    threads are used to perform processing. It requires that the user code
    have a UI message pump available and always operate from the same
    thread, or marshal the call onto another thread.

    When you use this timer, use the Tick event to perform a polling
    operation or to display a splash screen for a specified period of
    time. Whenever the Enabled property is set to true and the Interval
    property is greater than zero, the Tick event is raised at intervals
    based on the Interval property setting.

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

Sidebar

Related Questions

I have developed a Windows application where a button is there on a form
After a button is clicked to start a process on my web app, I
I added a button in a listview item, and after the button is clicked,
I want the submit button to disappear after it's clicked and a new layer
What is the best way to close a form's webpage after the submit button
I am trying to call a subview after a button is clicked on my
I am developing a Windows Form Application with several pages. I am using a
In the following code every time button is clicked the alter shows the value
I want to change data on listview runtime after button click... here is my
How can I display a new window in JavaFX 2.0? For example after button

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.