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
Pavan Kumar
NA
12
3.2k
ProgressBar to stop when button clicked
Jun 25 2020 2:33 PM
I have written code for Progress Bar : Belowprogress is the code but progress bar has to stop when clicking Stop button can anyone help me in this please :
private
void
btn_StartLengthyTask_Click(
object
sender, RoutedEventArgs e)
{
pb_LengthyTaskProgress.Value = InitialSleepTime;
pb_LengthyTaskProgress.Maximum = 100;
Task.Run(() =>
{
for
(
int
i = 0; i < 101; i++)
{
this
.Dispatcher.Invoke(() =>
//Use Dispather to Update UI Immediately
{
pb_LengthyTaskProgress.Value = i;
lbl_CountDownTimer.Text = i.ToString();
});
Thread.Sleep(ThreadSleepTime) ;
// here i have to mention (or) clause for cancel button also.
}
});
}
Reply
Answers (
1
)
How to use beyond compare in visual studio
Adding an icon to my release exe using .msi install wizard