Hi again experts.
Still having problems with the backgroundworker etc. Here is my test
simulation.
Form1 has a start button
BusyBox has a ‘Please Wait…’ label
Form2 has no controls
When start is clicked, display the BusyBox with a delay. The BusyBox should
also display a progressbar, animated gif or anything that move to indicate
something is happening. After the delay, the BusyBox closes and Form2 is
shown.
Here is my code where I cannot even get the label to display !
Thanks in advance for any help or advice.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs
e)
{
BackgroundWorker bw = sender as BackgroundWorker;
TimeConsumingOperation(bw);
}
private void backgroundWorker1_RunWorkerCompleted(object sender,
RunWorkerCompletedEventArgs e)
{
Form frm = new Form2();
frm.Show();
}
private void TimeConsumingOperation(BackgroundWorker bw)
{
Form frmB = new BusyBox();
frmB.Show();
long i = 0;
while (i != 3000000000)
{
i++;
}
frmB.Dispose();
}
private void startBtn_Click(object sender, EventArgs e)
{
this.backgroundWorker1.RunWorkerAsync();
}