Click here to Skip to main content
15,898,373 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing datatable without interface. Pin
PyroManiak29-Jun-06 22:49
PyroManiak29-Jun-06 22:49 
QuestionHow to catch event for contextMenuStrip Pin
superdragon29-Jun-06 11:36
superdragon29-Jun-06 11:36 
AnswerRe: How to catch event for contextMenuStrip Pin
Jun Du29-Jun-06 12:03
Jun Du29-Jun-06 12:03 
GeneralRe: How to catch event for contextMenuStrip Pin
superdragon29-Jun-06 12:22
superdragon29-Jun-06 12:22 
Questionmultithreading problem Pin
CherezZaboro29-Jun-06 10:58
CherezZaboro29-Jun-06 10:58 
AnswerRe: multithreading problem Pin
Josh Smith29-Jun-06 11:10
Josh Smith29-Jun-06 11:10 
QuestionRe: multithreading problem Pin
therealmccoy29-Jun-06 12:03
therealmccoy29-Jun-06 12:03 
AnswerRe: multithreading problem Pin
Mike Poz29-Jun-06 21:22
Mike Poz29-Jun-06 21:22 
Sounds like you need to do a combination of threading and callback when an invoke is required.

Here's some of what I did to leave my UI reponsive in my first threaded app while katakana and hiragana flashcards were being displayed to the user.

//create a thread and a delegate in my class description
private Thread MyCardDisplayThread = null;
delegate void MyAllPurposeCallBack();

//start the thread in one of my many methods
MyCardDisplayThread = new Thread(new ThreadStart(ShowCharacterList));
MyCardDisplayThread.Start();

//use the delegate to process UI changes
//Note: This method is called inside "ShowCharacterList()" method
private void ShowHiraganaFlashCard()
{
if (this.KanaCardPictureBox.InvokeRequired)
{
//invoke is required so use the delegate to perform the invoke
MyAllPurposeCallBack KanaCardDisplay = new MyAllPurposeCallBack(ShowHiraganaFlashCard);
this.Invoke(KanaCardDisplay);
}
else
{
//invoke is not required or has been achieved and so do what the method
//was designed for in the first place
this.KanaCardPictureBox.Image = new Bitmap(AppPath+"\\"+HiraganaCards[CurrentKanaIndex]);
if (1 == RunningMode)
{
//this isn't visible during Test mode so only do this in flashcard mode
this.RomajiDisplayLabel.Text = null;
}
}
}

For every UI manipulation action that you want to perform while you have a process running on another thread, you have to check for InvokeRequired and then use the callback delegate to perform that invoke if it is required, otherwise do what ever that UI manipulation is intended to do.

Hope this helps!

Mike Poz
GeneralRe: multithreading problem Pin
CherezZaboro30-Jun-06 5:50
CherezZaboro30-Jun-06 5:50 
GeneralRe: multithreading problem Pin
Mike Poz30-Jun-06 7:02
Mike Poz30-Jun-06 7:02 
QuestionRe: multithreading problem Pin
CherezZaboro30-Jun-06 7:27
CherezZaboro30-Jun-06 7:27 
AnswerRe: multithreading problem Pin
Mike Poz30-Jun-06 10:40
Mike Poz30-Jun-06 10:40 
QuestionReflection with static inherited methods Pin
osamahmirza29-Jun-06 10:45
osamahmirza29-Jun-06 10:45 
AnswerRe: Reflection with static inherited methods Pin
Josh Smith29-Jun-06 11:04
Josh Smith29-Jun-06 11:04 
GeneralRe: Reflection with static inherited methods Pin
guroo1329-Jun-06 12:57
guroo1329-Jun-06 12:57 
AnswerRe: Reflection with static inherited methods Pin
Guffa29-Jun-06 13:40
Guffa29-Jun-06 13:40 
GeneralRe: Reflection with static inherited methods Pin
guroo1329-Jun-06 13:51
guroo1329-Jun-06 13:51 
QuestionVS 2005 User Control Toolbox question Pin
LongRange.Shooter29-Jun-06 10:34
LongRange.Shooter29-Jun-06 10:34 
AnswerRe: VS 2005 User Control Toolbox question Pin
Kamal Sagar30-Jun-06 1:10
Kamal Sagar30-Jun-06 1:10 
GeneralRe: VS 2005 User Control Toolbox question Pin
LongRange.Shooter30-Jun-06 11:55
LongRange.Shooter30-Jun-06 11:55 
QuestionHere's a wierd one for you... Pin
BoneSoft29-Jun-06 10:29
BoneSoft29-Jun-06 10:29 
AnswerRe: Here's a wierd one for you... Pin
LongRange.Shooter29-Jun-06 10:38
LongRange.Shooter29-Jun-06 10:38 
GeneralRe: Here's a wierd one for you... Pin
BoneSoft29-Jun-06 10:44
BoneSoft29-Jun-06 10:44 
AnswerRe: Here's a wierd one for you... Pin
led mike29-Jun-06 10:51
led mike29-Jun-06 10:51 
GeneralRe: Here's a wierd one for you... Pin
BoneSoft29-Jun-06 10:55
BoneSoft29-Jun-06 10:55 

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.