Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
GeneralBackgroundWorker question Pin
RugbyLeague23-Jan-08 1:50
RugbyLeague23-Jan-08 1:50 
GeneralRe: BackgroundWorker question Pin
Ed.Poore23-Jan-08 1:56
Ed.Poore23-Jan-08 1:56 
GeneralRe: BackgroundWorker question Pin
RugbyLeague23-Jan-08 2:03
RugbyLeague23-Jan-08 2:03 
GeneralRe: BackgroundWorker question Pin
S. Senthil Kumar23-Jan-08 6:09
S. Senthil Kumar23-Jan-08 6:09 
GeneralRe: BackgroundWorker question Pin
RugbyLeague23-Jan-08 6:21
RugbyLeague23-Jan-08 6:21 
GeneralRe: BackgroundWorker question Pin
S. Senthil Kumar23-Jan-08 6:53
S. Senthil Kumar23-Jan-08 6:53 
GeneralRe: BackgroundWorker question Pin
RugbyLeague23-Jan-08 6:54
RugbyLeague23-Jan-08 6:54 
GeneralRe: BackgroundWorker question Pin
Ed.Poore23-Jan-08 7:18
Ed.Poore23-Jan-08 7:18 
Not quite, you're probably going to get a ThreadAccessException if you do that. You'll need to create a delegate which can return the value. You can then pass this delegate to the Control.Invoke method to retrieve the value. Alternatively you can use the feature of anonymous delegates (can't remember what it's called) where you can access the variables surrounding it. E.g. (note I'm writing this code from memory)
C#
internal delaget int GetCurrentCount();
private int count = 100;

private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
  // Some code here
  int threadedCount = -1;
  // Now we want to return the value so...
  this.Invoke(new GetCurrentCount(delegate() { threadedCount = this.count; }));

  // Now threadedCount should equal 100
  // More code...
}



Generalhttp port listening using sockets. Pin
_tasleem23-Jan-08 1:30
_tasleem23-Jan-08 1:30 
GeneralRe: http port listening using sockets. Pin
stancrm23-Jan-08 1:46
stancrm23-Jan-08 1:46 
QuestionHow to preview setup dialogs in setup project ? Pin
hdv21223-Jan-08 1:29
hdv21223-Jan-08 1:29 
AnswerRe: How to preview setup dialogs in setup project ? Pin
hdv21223-Jan-08 10:43
hdv21223-Jan-08 10:43 
GeneralRe: How to preview setup dialogs in setup project ? Pin
Jimmanuel23-Jan-08 11:22
Jimmanuel23-Jan-08 11:22 
QuestionTree View Pin
Aparna.B23-Jan-08 1:10
Aparna.B23-Jan-08 1:10 
GeneralRe: Tree View Pin
Justin Perez23-Jan-08 3:57
Justin Perez23-Jan-08 3:57 
GeneralRe: Tree View Pin
Aparna.B23-Jan-08 16:40
Aparna.B23-Jan-08 16:40 
GeneralRe: Tree View Pin
Justin Perez24-Jan-08 1:59
Justin Perez24-Jan-08 1:59 
Generalstreamwrite Pin
arkiboys23-Jan-08 0:55
arkiboys23-Jan-08 0:55 
GeneralRe: streamwrite Pin
darkelv23-Jan-08 0:59
darkelv23-Jan-08 0:59 
GeneralRe: streamwrite Pin
arkiboys23-Jan-08 1:14
arkiboys23-Jan-08 1:14 
GeneralRe: streamwrite [modified] Pin
darkelv23-Jan-08 1:37
darkelv23-Jan-08 1:37 
AnswerRe: streamwrite Pin
arkiboys23-Jan-08 2:05
arkiboys23-Jan-08 2:05 
GeneralRe: streamwrite Pin
Thomas Stockwell23-Jan-08 8:09
professionalThomas Stockwell23-Jan-08 8:09 
QuestionHow to update/delete outlook appointments Pin
NewToAspDotNet23-Jan-08 0:17
NewToAspDotNet23-Jan-08 0:17 
AnswerRe: How to update/delete outlook appointments Pin
Jimmanuel23-Jan-08 3:12
Jimmanuel23-Jan-08 3:12 

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.