Click here to Skip to main content
15,913,854 members
Home / Discussions / C#
   

C#

 
AnswerRe: Help reading window titles and text in c sharp [modified] Pin
DaveyM697-Jun-11 10:14
professionalDaveyM697-Jun-11 10:14 
GeneralRe: Help reading window titles and text in c sharp Pin
turbosupramk37-Jun-11 11:00
turbosupramk37-Jun-11 11:00 
GeneralRe: Help reading window titles and text in c sharp Pin
DaveyM697-Jun-11 11:25
professionalDaveyM697-Jun-11 11:25 
GeneralRe: Help reading window titles and text in c sharp Pin
Pete O'Hanlon7-Jun-11 11:38
mvePete O'Hanlon7-Jun-11 11:38 
GeneralRe: Help reading window titles and text in c sharp Pin
DaveyM697-Jun-11 11:54
professionalDaveyM697-Jun-11 11:54 
GeneralRe: Help reading window titles and text in c sharp Pin
DaveyM697-Jun-11 12:00
professionalDaveyM697-Jun-11 12:00 
QuestionWhy exception is not caught in BackgroundWorker DoWork routine? Pin
Chesnokov Yuriy7-Jun-11 3:56
professionalChesnokov Yuriy7-Jun-11 3:56 
AnswerRe: Why exception is not caught in BackgroundWorker DoWork routine? Pin
Ian Shlasko7-Jun-11 4:07
Ian Shlasko7-Jun-11 4:07 
That's normal behavior. The exception doesn't get thrown across the thread boundary.

Of course, a background worker can return any object as a result, so when I use them (And I do, extensively), I do it like this:
private void SomethingBackground(object sender, DoWorkEventArgs e)
{
  try
  {
     // ...
  }
  catch (SomethingSomethingException ex)
  {
     // normal exception handling
  }
  catch (Exception ex)
  {
     e.Result = ex;
  }
}

// And in the caller:
if (e.Result is Exception)
  throw (Exception)e.Result;  // Or you could handle it some other way here
else
{
  // Normal result processing
}

If you're doing this a lot, you could even make a generic wrapper to centralize the code... Plenty of options.


Nevermind... Not enough caffeine...
Proud to have finally moved to the A-Ark. Which one are you in?
Author of the Guardians Saga (Sci-Fi/Fantasy novels)

GeneralRe: Why exception is not caught in BackgroundWorker DoWork routine? Pin
Chesnokov Yuriy7-Jun-11 4:17
professionalChesnokov Yuriy7-Jun-11 4:17 
QuestionRe: Why exception is not caught in BackgroundWorker DoWork routine? Pin
Luc Pattyn7-Jun-11 4:43
sitebuilderLuc Pattyn7-Jun-11 4:43 
AnswerRe: Why exception is not caught in BackgroundWorker DoWork routine? Pin
Ian Shlasko7-Jun-11 5:12
Ian Shlasko7-Jun-11 5:12 
AnswerRe: Why exception is not caught in BackgroundWorker DoWork routine? Pin
ShadowUz7-Jun-11 21:12
ShadowUz7-Jun-11 21:12 
QuestionNotifying Network Applications Pin
NameNotYetTaken7-Jun-11 3:18
NameNotYetTaken7-Jun-11 3:18 
AnswerRe: Notifying Network Applications Pin
Dave Kreskowiak7-Jun-11 3:46
mveDave Kreskowiak7-Jun-11 3:46 
AnswerRe: Notifying Network Applications Pin
Luc Pattyn7-Jun-11 4:51
sitebuilderLuc Pattyn7-Jun-11 4:51 
GeneralRe: Notifying Network Applications Pin
NameNotYetTaken7-Jun-11 5:18
NameNotYetTaken7-Jun-11 5:18 
AnswerRe: Notifying Network Applications Pin
Luc Pattyn7-Jun-11 5:39
sitebuilderLuc Pattyn7-Jun-11 5:39 
GeneralRe: Notifying Network Applications Pin
NameNotYetTaken7-Jun-11 6:08
NameNotYetTaken7-Jun-11 6:08 
AnswerRe: Notifying Network Applications Pin
BobJanova7-Jun-11 5:27
BobJanova7-Jun-11 5:27 
QuestionMerging C# WPF projects Pin
Member 79112937-Jun-11 2:23
Member 79112937-Jun-11 2:23 
AnswerRe: Merging C# WPF projects Pin
Pete O'Hanlon7-Jun-11 2:32
mvePete O'Hanlon7-Jun-11 2:32 
AnswerRe: Merging C# WPF projects Pin
V.7-Jun-11 3:37
professionalV.7-Jun-11 3:37 
QuestionHow to fix English language to specific textbox in Arabic Input language mode? Pin
Paramu19737-Jun-11 0:29
Paramu19737-Jun-11 0:29 
AnswerRe: How to fix English language to specific textbox in Arabic Input language mode? Pin
raja4india15-Oct-11 5:35
raja4india15-Oct-11 5:35 
Questionsensing data passed through lan card of a pc Pin
Aisha sharma6-Jun-11 21:09
Aisha sharma6-Jun-11 21:09 

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.