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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:44:16+00:00 2026-05-27T08:44:16+00:00

I created a button to start the timer and the interval of timer is

  • 0

I created a button to start the timer and the interval of timer is 1000.
I added a timer_Tick() event handler but it is not working, I dont understand the reason.

Here is my code:

void button1_Click(...)
{
    this->timer->Start();
    for( int i = 0; i < 1000; i++ )
        Thread::Sleep(1000);
    this->timer->Stop();
}

void timer_Tick(...)
{
    this->textBox->Text = "njmk"; // only to handle while debugging but it is not handled
}

Note: I added this:

this->timer->Tick += gcnew System::EventHandler(this, &Form1::timer_Tick);

EDIT :

OK, I will try to explain my problem clearly.
I have a main form and in the status strip I have a toolstripprogressbar.
When I click a button, a function will start parsing a file and the progress bar must show the progress of the function. So here is my code:

void button_click(...)
{
    this->progressBar->Visible = true;
    this->backGroundWorker->RunWorkerAsync();
}

void backGorundWorker_DoWork(...)
{
    this->timer->Start();
    ParseFunction(); // it takes about two minute
    this->timer->Stop();
}

void timer_Tick(...)
{
    this->bacGroundWorker->ReportProgress(5);
}

void backGroundWorker_ProgressChanged(...)
{
    this->progressBar->Value += e->ProgressPercentage();
}
void backGroundWorker_RunWorkerComplete(...)
{
    this->progressBar->Visible = false;
}
  • 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-27T08:44:17+00:00Added an answer on May 27, 2026 at 8:44 am

    It’s not working because you’re making the thread (UI thread) sleep for 1000 * 1000 milliseconds (~16 minutes):

    void button1_Click(...)
    {
        this->timer->Start();
        for( int i = 0; i < 1000; i++ )
            Thread::Sleep(1000);
        this->timer->Stop();
    }
    

    That’s why it can’t update the textbox content.

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

Sidebar

Related Questions

I created a button and added an action for it, but as soon as
I've created a button (symbol), and added a OVER state, which covers a bigger
Actually I created a button using the cobogw widget library. But the button does
I have created button 2 below: <input id=Button1 type=button value=Stop onclick=alert('hello world');/> <input id=Button2
I created a button and I need it to restart the form I have
I have created a button CSS class that uses background images with different positions
i have a table which contains a bunch of dynamically created radio button lists,
I am new to iphone development. I have created a button in the view.
I created a custom button component that accepts an array as a property. I
i've created a select button with 3 option <%= f.label :prioridad %><br/> <%= f.select

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.