Click here to Skip to main content
15,891,905 members
Home / Discussions / C#
   

C#

 
AnswerRe: "select" statement in C# with a string array Pin
Mycroft Holmes8-Nov-13 20:06
professionalMycroft Holmes8-Nov-13 20:06 
AnswerRe: "select" statement in C# with a string array Pin
OriginalGriff8-Nov-13 23:24
mveOriginalGriff8-Nov-13 23:24 
SuggestionRe: "select" statement in C# with a string array Pin
Richard Deeming11-Nov-13 1:21
mveRichard Deeming11-Nov-13 1:21 
AnswerRe: "select" statement in C# with a string array Pin
Richard Deeming11-Nov-13 1:27
mveRichard Deeming11-Nov-13 1:27 
QuestionGraphic Program Help Pin
Gengou8-Nov-13 9:32
professionalGengou8-Nov-13 9:32 
AnswerRe: Graphic Program Help Pin
BillWoodruff9-Nov-13 1:43
professionalBillWoodruff9-Nov-13 1:43 
QuestionVisio and C# Pin
Raju_N8-Nov-13 9:13
professionalRaju_N8-Nov-13 9:13 
Questionc# coding a progress bar with barkground worker Pin
PClarkeirl8-Nov-13 3:35
PClarkeirl8-Nov-13 3:35 
Hi,
I am relatively new to c# and I am trying to utilize a background worker to run the progressBar however I am not getting beyond 1% in the following example. In the Form1_Load I have an iteration inside which I want to display the ProgressBar. Appreciate if someone can point out where I am going wrong with this logic.

Pat



namespace WindowsFormsApplication1
{

public partial class Form1 : Form
{
BackgroundWorker bgw = new BackgroundWorker();
float tot1=100;
float cnt1=0;
float rslt = 0;
int percents = 0;
public Form1()
{
InitializeComponent();
label1.Text = "";
label2.Text = "";
}


void bgw_DoWork(object sender, DoWorkEventArgs e)
{
{
System.Threading.Thread.Sleep(500);
rslt = ((cnt1 / tot1) * 100);
percents = Convert.ToInt32(rslt);
bgw.ReportProgress(percents, cnt1);
}
}

void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
progressBar1.Value = e.ProgressPercentage;
label1.Text = String.Format("Progress: {0} %", e.ProgressPercentage);
label2.Text = String.Format("Total items transfered: {0}", e.UserState);
}

void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//do the code when bgv completes its work
}

private void Form1_Load(object sender, EventArgs e)
{
for (cnt1 = 0; cnt1 <= tot1; cnt1++) //some number (total)
{
bgw.DoWork += new DoWorkEventHandler(bgw_DoWork);
bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);
bgw.WorkerReportsProgress = true;
if (!bgw.IsBusy)
{
bgw.RunWorkerAsync();
}
}
}

private void progressBar1_Click(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{

}
}
}
AnswerRe: c# coding a progress bar with barkground worker Pin
Richard Andrew x648-Nov-13 3:45
professionalRichard Andrew x648-Nov-13 3:45 
AnswerRe: c# coding a progress bar with barkground worker Pin
BillWoodruff8-Nov-13 3:55
professionalBillWoodruff8-Nov-13 3:55 
AnswerRe: c# coding a progress bar with barkground worker Pin
OriginalGriff8-Nov-13 5:14
mveOriginalGriff8-Nov-13 5:14 
Questionhow to store radiobutton status in app.config Pin
Member 102635197-Nov-13 23:11
Member 102635197-Nov-13 23:11 
AnswerRe: how to store radiobutton status in app.config Pin
Marco Bertschi8-Nov-13 0:19
protectorMarco Bertschi8-Nov-13 0:19 
GeneralMessage Closed Pin
8-Nov-13 1:06
Member 102635198-Nov-13 1:06 
GeneralRe: how to store radiobutton status in app.config Pin
Nicholas Marty8-Nov-13 3:02
professionalNicholas Marty8-Nov-13 3:02 
GeneralRe: how to store radiobutton status in app.config Pin
Member 1026351910-Nov-13 19:45
Member 1026351910-Nov-13 19:45 
QuestionGetting the value of TreeList in DevExpress Pin
nhanlaptrinh7-Nov-13 23:02
nhanlaptrinh7-Nov-13 23:02 
AnswerRe: Getting the value of TreeList in DevExpress Pin
Eddy Vluggen8-Nov-13 5:01
professionalEddy Vluggen8-Nov-13 5:01 
Questionforeach (TerminalGroup tg in vps) return tg; Pin
Marc W7-Nov-13 22:52
Marc W7-Nov-13 22:52 
AnswerRe: foreach (TerminalGroup tg in vps) return tg; Pin
Pete O'Hanlon7-Nov-13 23:47
mvePete O'Hanlon7-Nov-13 23:47 
GeneralRe: foreach (TerminalGroup tg in vps) return tg; Pin
harold aptroot7-Nov-13 23:54
harold aptroot7-Nov-13 23:54 
GeneralRe: foreach (TerminalGroup tg in vps) return tg; Pin
Marc W8-Nov-13 0:11
Marc W8-Nov-13 0:11 
GeneralRe: foreach (TerminalGroup tg in vps) return tg; Pin
harold aptroot8-Nov-13 0:35
harold aptroot8-Nov-13 0:35 
QuestionHow to Create a Deleted Database using LINQ-to-SQL-Classes? Pin
salehne7-Nov-13 18:50
salehne7-Nov-13 18:50 
Questioncombobox in c# Pin
Member 102635197-Nov-13 18:44
Member 102635197-Nov-13 18:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.