I have a little problem. I have a lot of code in the backgroundWorker2 (//Do Stuff)
When pressing the button1_Click, everything works great and the code executes for the backgroundworker.

But if I now try to drag the form around on the desktop, the form will "get stuck"(Not Responding). It seems that something isnĀ“t ready yet, it seems that the backgroundworker still is doing something even that I have confirmed by code that it has reached its defenitive last line of code. I can wait for a minute after it is ready too and the same problem happens ?

If I put all code as it is in the button1_Click instead, it works fine.

It is to much code to post here but what could this depend on. Could there be anything with the backgroundWorkercontrol that I have to check that it is ready or anything simular to this ?

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
     backgroundWorker2->RunWorkerAsync();
}


private: System::Void backgroundWorker2_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) 
{
//Do stuff
}

I have searched the code and tried to see where the problem is and I have found these lines that I use.

If I uncomment these lines, the application will work properly and the Form will not "get stuck" and "Not Respond".
So these lines works if I use them inside a common button_Click event but not in the backgroundWorker ?

However the panels needs to be visible/invisible as the code shows.

panel5->Visible = false;
 panel13->Visible = false;
 panel14->Visible = false;
 panel15->Visible = false;
 panel20->Visible = false;

 panel8->Visible = true;
 panel8->Dock = DockStyle::Fill;
 Form2::Text = "New Text";

What language is this? Is it "managed" C++?

Yes it is, it is managed C++ in Visual C++ 2008 Express Edition.

What language is this? Is it "managed" C++?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.