gilllyo
asked on
Passing a string through a BackgroundWorker's RunWorkerAsync
I have a Bacground Worker where it needs a string. I have put the string in the RunWorkerAsync function but when I try to cast the sender variable back to a string with the following line..
Calling method:
String^ arg=this->GenerateArg();
MessageBox::Show(arg);
this->threadPleaseWait->Ru nWorkerAsy nc(arg);
casting Method
String args = dynamic_cast<String^>(send er);
arg is a String^, I get what I expect in the message box but when casting the 'args' value is null
Calling method:
String^ arg=this->GenerateArg();
MessageBox::Show(arg);
this->threadPleaseWait->Ru
casting Method
String args = dynamic_cast<String^>(send
arg is a String^, I get what I expect in the message box but when casting the 'args' value is null
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
HAve you tried to use safe_cast instead ?
BTW, sender is BackgroundWorker itself. You need to cast it to BackgroundWorker and use inside of DoWork function.
ASKER
Thanks
I have fixed that up...
I have fixed that up...