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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:03:09+00:00 2026-06-12T07:03:09+00:00

I have a form with a TabControl in a Visual Studio project, with 4

  • 0

I have a form with a TabControl in a Visual Studio project, with 4 tabs.

When I load the form, I prepare only 3 tabs.

If the user switches to the 4th tab, I have to do some math before display data in the tab.

When switching I experience some graphics artefact, as show below:

enter image description here

(don’t look at the blurried, look at the while stripe in the middle and the cutted graphics on the right)

I tried Suspending Layout before doing the math but probably in the TabControl.SelectedIndexChanged the drawing has already begun.
And no, there is no changING event.

How can I solve this issue? Possibly without using a separate thread.

  • 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-12T07:03:10+00:00Added an answer on June 12, 2026 at 7:03 am

    Since you say that the artifact corrects itself after your calculation completes, this is most likely due to the fact that you are not giving the UI thread a chance to update the screen because you’re spending the CPU doing your calculation. You will likely need to use some sort of threading to resolve the issue.

    Windows Forms contains a nice BackgroundWorker control which can make this kind of task pretty simple. Just drag the control from the Toolbox onto your form designer and then create event handlers for the DoWork and RunWorkerCompleted events. Put your calculations in the DoWork handler and any updates to the UI that need to happen after the calculation completes in the RunWorkerCompleted handler (its important to note that you should not access any UI elements from the DoWork handler).

    Here is a brief code sample:

      public partial class Form1 : Form
      {
        private MyCalculationState _state;
    
        public Form1()
        {
          InitializeComponent();
        }
    
        private void Form1_Load(object sender, EventArgs e)
        {
          backgroundWorker1.RunWorkerAsync();
        }
    
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
          _state = new MyCalculationState();
    
          // Do some calculations
          _state.Value = 5;
        }
    
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
          // Update the UI after calculations are complete
          textBox1.Text = _state.Value.ToString();
        }
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Form with only a single TabControl , with many tabs, where
I have a form with a tabcontrol and 4 tabs. I want to open
I have a form which has only tab control in it. I want to
So I have a form with some tab objects, group objects and possible a
I currently have a Form with a TabControl containing some TabPage s. Each TabPage
i have a form, which hosts a tabcontrol. each of these tabs have plenty
I have a TabControl in a windows form. I have pragmaticly added new tabs
I have a form where I can add tabs into a tabcontrol by pressing
I'm designing a windows form with a TabControl that contains 2 tabs. I have
I have a Wpf Form with a tabControl with 2 tabs Customers and CustomerDetail

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.