Hello,
I do not know anything about Thread. And I know this question is answered in many forums, but nothing worked for me.
My calculatins are very complex and long and I need at the start of calculations, a progress gif in a picturebox set to visible, and at the end, set to false. My .NET framework is 4.0. I saw a simple examle in the forums but it dose not work.
Any seggestions?
Thank you
namespace Thread_Example
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int count = 0;
pictureBoxProgress.Invoke(new Action(() => pictureBoxProgress.Visible = true)); //does not work
// This loop is an example of a very complex calculations.
// Do not consider its 'count' or 'i'.
for(int i =0; i < 10000000; i++)
{
count += 1;
}
pictureBoxProgress.Invoke(new Action(() => pictureBoxProgress.Visible = false));//does not work
}
private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Visible = false;
}
}
}