TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Farhan Shariff
NA
933
241.7k
Using Process Bar
Aug 8 2014 5:00 AM
I am trying to start process bar when buton4 is clicked and stop the process bar when the program is complete(comparisonCompleted = true;)
I am getting error cross thread operation not valid I tried using background worker but exactly not know how to use it
private void button4_Click(object sender, EventArgs e)
{
button4.Enabled = false;
//----------
Thread t = new Thread(GoCompare);
t.IsBackground = true;
t.Start();
}
private void GoCompare()
{
ProgressBar pBar = new ProgressBar();
Controls.Add(pBar);
pBar.Name = "ProgresBar1";
pBar.Dock = DockStyle.Bottom;
pBar.Style = ProgressBarStyle.Marquee;
pBar.MarqueeAnimationSpeed = 10;
pBar.Width = 100;
pBar.Height = 30;
pBar.Minimum = 0;
pBar.Maximum = 100;
pBar.Value = 100;
bool comparisonCompleted;
comparisonCompleted = false;
/*------------------------------
---------------------------------
----------Statements ------------- */
comparisonCompleted = true;
pBar.Style = ProgressBarStyle.Continuous;//error
pBar.MarqueeAnimationSpeed = 0;
}
Reply
Answers (
2
)
Regular Expression pls
Applying existing Css to dynamically created button