Without actually seeing how you're communicating with the progress window
it's a bit difficult to make a reccomendation. To illustrate how I might
accomplish the same thing I have included a project in the text below my
signature.
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
------------------------------------------------------
namespace Progresswindow
{
public class Form1 : Form
{
int progress = 0;
Timer t;
Progress dlg = new Progress();
public Form1()
{
InitializeComponent();
}
private void StartProgress()
{
progress=0;
t = new Timer();
t.Interval = 100;
t.Tick += new EventHandler(t_Tick);
t.Enabled = true;
dlg.ShowDialog();
}
void t_Tick(object sender, EventArgs e)
{
progress++;
if (progress < 101)
dlg.ProgressValue = progress;
else
{
t.Enabled = false;
t = null;
}
}
private void button1_Click(object sender, EventArgs e)
{
StartProgress();
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(85, 111);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "Start";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 264);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
}
public class Progress : Form
{
int progress;
public int ProgressValue
{
get { return progress; }
set
{
if (value == 100)
{
this.Close();
}
else
{
progress = value;
this.progressBar1.Value = value;
this.label1.Text = value.ToString();
}
}
}
public Progress()
{
InitializeComponent();
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(12, 50);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(260, 23);
this.progressBar1.TabIndex = 0;
//
// label1
//
this.label1.Location = new System.Drawing.Point(12, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(260, 23);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Progress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 90);
this.Controls.Add(this.label1);
this.Controls.Add(this.progressBar1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Progress";
this.Text = "Progress";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label1;
}
}
-------------------------------------------------------
Nathan Smith said:
No data binding. Here's what I'm doing...
[Sample start]
'create a progress window
Dim progDlg As New Banner
progDlg.TextBox1.Text = "Please Wait..."
'set the progress bar to start pos
progDlg.ProgBar.Increment(10)
progDlg.Show()
[Sample End]
Bob Powell said:
Are you using databinding?
Can you post some code...
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.