Click here to Skip to main content
15,911,317 members
Home / Discussions / C#
   

C#

 
GeneralRe: rdlc repoting - center image in picturebox Pin
Alan N15-Apr-08 8:50
Alan N15-Apr-08 8:50 
GeneralRe: rdlc repoting - center image in picturebox Pin
AJ du Plessis15-Apr-08 9:01
AJ du Plessis15-Apr-08 9:01 
GeneralKeyboard hooks and sendinput.. Pin
Bakaneko15-Apr-08 6:26
Bakaneko15-Apr-08 6:26 
GeneralRe: Keyboard hooks and sendinput.. Pin
Anthony Mushrow15-Apr-08 7:00
professionalAnthony Mushrow15-Apr-08 7:00 
GeneralRe: Keyboard hooks and sendinput.. [modified] Pin
Bakaneko15-Apr-08 7:10
Bakaneko15-Apr-08 7:10 
GeneralRe: Keyboard hooks and sendinput.. Pin
Bakaneko15-Apr-08 11:57
Bakaneko15-Apr-08 11:57 
GeneralRe: Keyboard hooks and sendinput.. Pin
Bakaneko15-Apr-08 12:55
Bakaneko15-Apr-08 12:55 
QuestionUpdate/Refresh Form Pin
Alessandra7715-Apr-08 5:41
Alessandra7715-Apr-08 5:41 
GeneralRe: Update/Refresh Form Pin
Waleed Eissa15-Apr-08 5:56
Waleed Eissa15-Apr-08 5:56 
GeneralRe: Update/Refresh Form Pin
Alessandra7715-Apr-08 6:04
Alessandra7715-Apr-08 6:04 
GeneralRe: Update/Refresh Form Pin
Waleed Eissa15-Apr-08 6:06
Waleed Eissa15-Apr-08 6:06 
GeneralRe: Update/Refresh Form Pin
Alessandra7715-Apr-08 6:24
Alessandra7715-Apr-08 6:24 
GeneralRe: Update/Refresh Form Pin
Anthony Mushrow15-Apr-08 7:07
professionalAnthony Mushrow15-Apr-08 7:07 
GeneralRe: Update/Refresh Form Pin
Waleed Eissa15-Apr-08 20:44
Waleed Eissa15-Apr-08 20:44 
GeneralShowDialog from seperate thread Pin
lgelliott15-Apr-08 5:06
lgelliott15-Apr-08 5:06 
GeneralRe: ShowDialog from seperate thread Pin
Judah Gabriel Himango15-Apr-08 6:19
sponsorJudah Gabriel Himango15-Apr-08 6:19 
First, it sounds like you're abusing the BackgroundWorker. The BackgroundWorker is meant for running non-UI work on a background thread. If you want to update the UI during that work, call worker.ReportProgress, which will fire the ProgressChanged event on the UI thread. Also, the RunWorkerCompleted event will fire when the work is done, and it will fire on the UI thread.

If you really have to create forms or controls on a background thread, you must ensure that the thread is STA. Look at Thread.SetApartmentState before you start the thread. You can't make BackgroundWorker threads be STA, so the BackgroundWorker won't work for this.

Ideally, however, you use just a single thread to create and change your UI controls. Without this, you're going to have thread marshalling nightmares if different UIs need to be accessed on different threads.

To sum up, use a background worker to perform non-UI related work on a background thread. If you need to update the UI from this background thread, call worker.ReportProgress and do the UI update inside a worker.ProgressChanged event handler.





GeneralRe: ShowDialog from seperate thread Pin
lgelliott15-Apr-08 7:44
lgelliott15-Apr-08 7:44 
GeneralRe: ShowDialog from seperate thread Pin
Judah Gabriel Himango15-Apr-08 10:02
sponsorJudah Gabriel Himango15-Apr-08 10:02 
GeneralRe: ShowDialog from seperate thread Pin
lgelliott15-Apr-08 10:34
lgelliott15-Apr-08 10:34 
GeneralRe: ShowDialog from seperate thread Pin
Judah Gabriel Himango15-Apr-08 11:37
sponsorJudah Gabriel Himango15-Apr-08 11:37 
GeneralRe: ShowDialog from seperate thread Pin
lgelliott15-Apr-08 14:15
lgelliott15-Apr-08 14:15 
GeneralRe: ShowDialog from seperate thread Pin
lgelliott15-Apr-08 15:10
lgelliott15-Apr-08 15:10 
GeneralRe: ShowDialog from seperate thread Pin
Judah Gabriel Himango16-Apr-08 4:13
sponsorJudah Gabriel Himango16-Apr-08 4:13 
GeneralRe: ShowDialog from seperate thread Pin
lgelliott17-Apr-08 2:48
lgelliott17-Apr-08 2:48 
GeneralRe: ShowDialog from seperate thread Pin
Judah Gabriel Himango17-Apr-08 4:46
sponsorJudah Gabriel Himango17-Apr-08 4:46 

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.