G
Guest
Hi,
I have a MainForm Class that loads childforms inside a panel... this main
form has a toolbar.
Currently I use a thread load a splash, that is working currectly, now I
want to have another thread to show the progress in the status bar of some
processes I need to do.
Here is the scene:
public MainForm()
{
InitializeComponent();
......
this.EndSplash();
Thread process = new Thread( new ThreadStart(preprocess));
process.Start();
}
static void Main()
{
Thread th = new Thread(new ThreadStart(DoSplash));
th.Start();
Thread.Sleep(500);
........................
sp.label1.Text= "Ready, Now Loading the program!";
Thread.Sleep(500);
.......................
Application.Run(new MainForm());
public void EndSplash()
{
sp.Invoke(new MethodInvoker(sp.Close));
}
static Splash sp = new Splash();
private static void DoSplash()
{
sp = new Splash();
sp.ShowDialog();
}
public void PreProcessing()
{
ColouredProgressBar pbar = new ColouredProgressBar.ColouredProgressBar();
StatusBarPanel ProgressPanel = new StatusBarPanel();
statusBar1.Parent = this;
statusBar1.ShowPanels = true;
StatusBarPanel panel1 = new StatusBarPanel();
panel1.AutoSize = StatusBarPanelAutoSize.Contents;
panel1.Text = "Mein Text";
statusBar1.Panels.Add(panel1);
ProgressPanel.AutoSize = StatusBarPanelAutoSize.None;
statusBar1.Panels.Add(ProgressPanel );
pbar.Parent = statusBar1;
pbar.Width = ProgressPanel.Width;
pbar.Location = new Point(panel1.Width, 0);
pbar.Height = statusBar1.Height -2;
pbar.Minimum = 0;
.............................
Get Maximum by SQL
............................
pbar.Maximum = Convert.ToInt16(oCmdCount.ExecuteScalar());
pbar.Value = 0;
.............................
Do a loop and each time I process info I increment
the progressbar (pbar) value
..............................
pbar.Value = pbar.Value++;
..............................
Get Out of the loop
...............................
panel1.Text="Process Completed";
}
I didi this way but It doesn't work.... any suggestions or corrections will
be appreciated
I have a MainForm Class that loads childforms inside a panel... this main
form has a toolbar.
Currently I use a thread load a splash, that is working currectly, now I
want to have another thread to show the progress in the status bar of some
processes I need to do.
Here is the scene:
public MainForm()
{
InitializeComponent();
......
this.EndSplash();
Thread process = new Thread( new ThreadStart(preprocess));
process.Start();
}
static void Main()
{
Thread th = new Thread(new ThreadStart(DoSplash));
th.Start();
Thread.Sleep(500);
........................
sp.label1.Text= "Ready, Now Loading the program!";
Thread.Sleep(500);
.......................
Application.Run(new MainForm());
public void EndSplash()
{
sp.Invoke(new MethodInvoker(sp.Close));
}
static Splash sp = new Splash();
private static void DoSplash()
{
sp = new Splash();
sp.ShowDialog();
}
public void PreProcessing()
{
ColouredProgressBar pbar = new ColouredProgressBar.ColouredProgressBar();
StatusBarPanel ProgressPanel = new StatusBarPanel();
statusBar1.Parent = this;
statusBar1.ShowPanels = true;
StatusBarPanel panel1 = new StatusBarPanel();
panel1.AutoSize = StatusBarPanelAutoSize.Contents;
panel1.Text = "Mein Text";
statusBar1.Panels.Add(panel1);
ProgressPanel.AutoSize = StatusBarPanelAutoSize.None;
statusBar1.Panels.Add(ProgressPanel );
pbar.Parent = statusBar1;
pbar.Width = ProgressPanel.Width;
pbar.Location = new Point(panel1.Width, 0);
pbar.Height = statusBar1.Height -2;
pbar.Minimum = 0;
.............................
Get Maximum by SQL
............................
pbar.Maximum = Convert.ToInt16(oCmdCount.ExecuteScalar());
pbar.Value = 0;
.............................
Do a loop and each time I process info I increment
the progressbar (pbar) value
..............................
pbar.Value = pbar.Value++;
..............................
Get Out of the loop
...............................
panel1.Text="Process Completed";
}
I didi this way but It doesn't work.... any suggestions or corrections will
be appreciated