Login
About Us
Search EggHeadCafe's Job Board
EggHeadCafe
Silverlight
WPF
ASP.NET
VB.NET
C#
Excel
SQL Server
SharePoint
Articles
Forums
FAQs
Groups
Top Members
Microsoft
Articles
Forums
FAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services
Web
Articles
Forums
FAQs
JavaScript
ASP
ASP.NET
WCF
Databases
Articles
Forums
FAQs
SQL Server
Access
Oracle
MySQL
Other Databases
Office
Articles
Forums
FAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money
Non-Microsoft
Articles
Forums
FAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source
Operating Sys
Articles
Forums
FAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX
Server Platforms
Articles
Forums
FAQs
BizTalk
Site Server
Exhange Server
IIS
Graphic Design
Articles
Forums
FAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web
Other
Articles
Forums
FAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes
Create Progress bar in windows application
By Raj Cool...
Printer Friendly Version
View My Articles
145 Views
I have written very big application where I am displaying the dialog box and connection is establishing in background and user can see in the status bar whats going on like 'Connecting to server XXX'...'sending password'...'connection rejected so trying to other server'...and at last 'Ready' message will be displayed in the status bar.
Steps to create ProgressBar:
----------------------------
Create Color fade busy bar using
private System.Windows.Forms.BusyBar.ColorFadeBusyBar progressBar;
add it to your initialize component
this.progressBar = new System.Windows.Forms.BusyBar.ColorFadeBusyBar();
This will auto generate while you create the component. Set the properties
this.progressBar.BackColor = System.Drawing.SystemColors.Control;
this.progressBar.BorderStyle3D = System.Windows.Forms.Border3DStyle.SunkenInner;
this.progressBar.Color2 = System.Drawing.SystemColors.Control;
this.progressBar.FadeLength = -30;
this.progressBar.ForeColor = System.Drawing.SystemColors.Highlight;
this.progressBar.Location = new System.Drawing.Point(191, 3);
this.progressBar.Name = "progressBar";
this.progressBar.PingPong = true;
this.progressBar.ShowBorder = true;
this.progressBar.Size = new System.Drawing.Size(86, 18);
this.progressBar.StepSize = 1;
this.progressBar.StepTimeout = 25;
this.progressBar.TabIndex = 65;
this.progressBar.Visible = false;
///
/// This method starts the progress bar
///
private void StartProgress() {
progressBar.Show();
progressBar.Start();
}
///
/// This method stops the progress bar
///
private void StopProgress() {
progressBar.Hide();
progressBar.Stop();
}
At last you will need thread process which writes and call this start and stop methods,.
///
/// This method starts a thread for reading the output from the transport
///
private void WaitingThread() {
//Thread waiting for the output stream of the process
StartProgress();
int TimeOutPeriod = 30; //sec
DateTime expireTime = DateTime.Now.AddSeconds(TimeOutPeriod);
outputThread = new Thread(new ThreadStart(ReadFromLoginOutput));
isApplicationTimedOut = false;
outputThread.Start();
while (outputThread.IsAlive && outputThread.ThreadState != System.Threading.ThreadState.AbortRequested) {
Thread.Sleep(100);
if(TimeOuPeriodt > 0) && (DateTime.Compare(expireTime, DateTime.Now) < 0)) {
outputThread.Abort();
isApplicationTimedOut = true;
}
Application.DoEvents();
}
StopProgress();
}
you can fetch the output from standard output in ReadfromLoginOutput method.
Regards,
Megha
EBCDIC Encoding with .NET
Standard Deviation in .NET ( STDEVPA )
In - Memory Data Compression with .NET PART II
Power of Reflection: Creating an Object Factory
Dr. Dotnetsky's Cool .NET Tips and Tricks # 5
Article Discussion: Create Progress bar in windows application
Raj Cool...
posted at Friday, October 17, 2008 10:19 AM
Original Article