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
lpc
NA
1
0
Background Worker Cancel Issue
Aug 31 2009 10:38 AM
I have a method call within the background worker doWork event like this.
try
{
classname.method(argument, argument, argument);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
how i can implement a cancel to background worker. where to check for cancel pending. if i write the code like this
while (!bgworker.CancellationPending)
{
try
{
classname.method(argument, argument, argument);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
if (bgworker.CancellationPending
e.Cancel = true;
then it keeps running again and again until the cancel button (bgworker.CancelAsync()) is not pressed. please help me i am new to C#. i search a lot but find examples which have loops in doWork, but i have method call.
Reply
Answers (
2
)
Window Service not able to call remoting object
Binding DataGrid Column Header at Runtime