according to my personal opinin using progress bar while submiting the data or reciving the data means the time wastage of end user
Posted by Vithal Wadje Jan 24, 2013
Hallo, ich versuche gerade eine ProgressBar in einer eigenen WinForm zu erstellen. Hier mein Ansatz: C#-Code: public partial class RIM_ProgressBar : Form { Thread _thread; int _val; public int Value { set {this._val=value; } get { return this._val; } } public RIM_ProgressBar(int min, int max, int actual) { InitializeComponent(); progressBar1.Minimum = min; progressBar1.Maximum = max; progressBar1.Value = actual; _val = actual; } private void RIM_ProgressBar_Load(object sender, EventArgs e) { _thread = new Thread(new ThreadStart(load)); _thread.Start(); } public void load() { progressBar1.Value = _val; statusStrip1.Text = progressBar1.Value.ToString() + "%omplete"; // Thread.Sleep(10); } public void changeValue(int val) { this._val = val; } } So ruf ich das auf: C#-Code: RIM_ProgressBar rProgBar = new RIM_ProgressBar(0, 100, 0); rProgBar.Show(); for (int i = 0; i < 100; i++) { rProgBar.Value = i; Thread.Sleep(10); } Es funktioniert nicht...
Posted by Puma D Ace Jul 06, 2011
Great article! Here you find another nice article about how to implement a WPF progress dialog: http://www.parago.de/2011/04/how-to-implement-a-modern-progress-dialog-for-wpf-applications/
Posted by Jürgen Bäurle Jun 18, 2011
http://www.csharphelp.com/wp-content/themes/twentyten/images/headers/path.jpg
Posted by Nasir Uddin Apr 28, 2011
For the Below Code, I want to add a progress bar: while data inserted into the another table. It takes 1 to 2 mins, for this I want to show the progress bar till the data completely not inserted


private void button1_Click_1(object sender, EventArgs e)
        {
            SqlConnection conn = null;
            try
            {
                conn = new SqlConnection(@"Data Source=HAIDER-IT;Initial Catalog=csoft;Integrated Security=True");
                conn.Open();
                SqlCommand cmd = new SqlCommand("Search",conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandTimeout = 1800;
                cmd.Parameters.Add("@P_prd", SqlDbType.VarChar, 50).Value = "11";
                cmd.Parameters.Add("@P_rep", SqlDbType.VarChar, 50).Value = "31";
                cmd.Parameters.Add("@P_yy", SqlDbType.VarChar, 50).Value = "2008";
                cmd.Parameters.Add("@P_mm", SqlDbType.VarChar, 50).Value = "04";
                cmd.Parameters.Add("@P_HS", SqlDbType.VarChar, 50).Value = "1";
                int I = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
          
              MessageBox.Show("Data Inserted");
           
        }

Posted by Sharique Imam Sep 08, 2010
well
Posted by jchbjsnc May 19, 2010
Hi..............
Thank you Mahesh Chand Sir for download files progrs_br1.zip.

From
Manoj kumar
Dehradun (UA)
+91-9458106336

Posted by Manoj kumar May 07, 2010

To understand how the C# Progress Bar works, read this post.

Posted by Ali Badereddin Feb 11, 2010
Thank u
Posted by arun chaturvedi Jan 01, 2010
Progress bar is simple, is it for web browser or just basic load of an event?
Posted by mark hughes Dec 24, 2009
Thanx pal for making it currect ,well the progressbar is working fine but the stop button is not working .I know calling abort in thread is not fair ,,can u make that stop button currect ...
Posted by Sreejith Thampy Apr 19, 2009
Hi I m Rehan Qureshi.........This code solved my big problems about the working of progress bar without experience........thank for that
Posted by Muhammad Rehan Qureshi Mar 21, 2009

Ok my freind you have made a serious mistake, you have made an illegal cross threaded manipulation, I explain, you have invoked the both progressbar1 and statusbar1 outside the thread where they have been created. As a solution to this problem you have to create a delegate that points to a method that perform the controls' modifications (progress for the progress bar and text change for the statusbar) and then invoke this delegate inside the thread method like this

 public Form1()
        {
            InitializeComponent();
           
        }
        //The thread
        Thread st;
        //The delegate instance
        Progress p;
        //The delegate class
        public delegate void Progress();

        private void Form1_Load(object sender, EventArgs e)
        {
            st = new Thread(new ThreadStart(load));
            p = new Progress(Perform);

        }
        //The method that will be pointed by  the delegate instance
        public void Perform()
        {
            for (int i = 0; i <= 100; i = i + 1)
            {
                progressBar1.Increment(i);
                statusStrip1.Text = progressBar1.Value.ToString() + "%omplete"; Thread.Sleep(10);
            }
            DialogResult dlg = MessageBox.Show("Do you want to close this window", "Do you want to exit this window", MessageBoxButtons.OKCancel);
            if (dlg == DialogResult.OK) Application.Exit();
          
        }
        //The thread method
        public void load()
        {
            Form1 form = this;
            form.Invoke(p);
        }
        //The button that triggers the thread
        private void button1_Click(object sender, EventArgs e)
        {
           st.Start();
           //To avoid thread multi invocation
           button1.Enabled = false;
        }
Posted by Bechir Bejaoui Mar 18, 2009
its the code for progress bar thank you
Posted by Sreejith Thampy Mar 16, 2009
using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
using System.Drawing;
using System.Linq;
 using System.Text;
using System.Windows.Forms;
 using System.Threading;
 namespace WindowsFormsApplication1
 {
 public partial class Form1 : Form { Thread st; public Form1() { InitializeComponent();
 }
private void Form1_Load(object sender, EventArgs e)
 {
st = new Thread(new ThreadStart(load));
 }
public void load()
 {
for (int i=0;i<=100;i=i+1)
 {
progressBar1.Increment(i);
statusStrip1.Text = progressBar1.Value.ToString() + "%omplete"; Thread.Sleep(500); }
}
private void progressBar1_Click(object sender, EventArgs e)
 {
}
 private void button1_Click(object sender, EventArgs e)
 {
st.Start();
 }
private void button2_Click(object sender, EventArgs e)
 {
 if (st.IsAlive)
{
 st.Abort();
 } } } }
Posted by Sreejith Thampy Mar 16, 2009
Hi, This is Surendra Gurjar, I learn from the this tutorial and it is very useful.
Posted by Surendra Gurjar Jan 28, 2009
hello i have problem to execute progress bar with oracel connection this is my code: Timer1.Start() Try Dim cn As New OracleConnection("Password=password;User ID=dph;Data Source=creative;Persist Security Info=True") cn.Open() cn.Close() Catch ex As Exception MsgBox("sdsqdqdq") End Try Timer1.Stop() think you
Posted by aissam cheikh Jul 26, 2007
Posted by Mahadevakumar G May 03, 2007
PREMIUM SPONSORS
Hire Mobile & Web Developer on demand. 100% satisfaction. Try for 1 week or Money Back. Local and remote developers available all over USA.
Employers - Post Free Jobs