Click here to Skip to main content
16,005,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Finally in threads Pin
S. Senthil Kumar10-Mar-05 20:05
S. Senthil Kumar10-Mar-05 20:05 
Generalstring foreach row's column Pin
lornej10-Mar-05 11:05
lornej10-Mar-05 11:05 
GeneralRe: string foreach row's column Pin
Colin Angus Mackay10-Mar-05 11:30
Colin Angus Mackay10-Mar-05 11:30 
GeneralRe: string foreach row's column Pin
J4amieC10-Mar-05 22:14
J4amieC10-Mar-05 22:14 
General.NET remoting and Simple Client / Server application design help... Pin
Kasdoffe10-Mar-05 10:50
Kasdoffe10-Mar-05 10:50 
GeneralRe: .NET remoting and Simple Client / Server application design help... Pin
Kasdoffe11-Mar-05 3:30
Kasdoffe11-Mar-05 3:30 
GeneralAsync Programming and Thread-safe Delegates Pin
BnWasteland10-Mar-05 9:29
BnWasteland10-Mar-05 9:29 
GeneralRe: Async Programming and Thread-safe Delegates Pin
TylerBrinks10-Mar-05 11:43
TylerBrinks10-Mar-05 11:43 
You don't need to do much to get your GUI to handle the threading issue. Just remember (as it seems you already know), never operate on your GUI from another thread.

That being said, I'd do the following:

1. Create a method in your GUI that is accessable from your thread.

2. Create a delegate that matches the signature of the method in step 1.

3. Use the GUI's ability to determine whether it needs invocation on its own thread within the method on the GUI.

4. Check out this 3 part article on MSDN
http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp[^]

private delegate void MyUIDelegate (string yourString, int yourInt);


protected void MyGUIMethod(string testString, int testInt)
{
    if(this.InvokeRequired)
    {
        // make sure the execution is on the UI's thread when called from another thread
        MyUIDelegate myDelegate = new MyUIDelegate (_taskPayne_MyGUIMethod);
        this.Invoke(myDelegate , new object[]{ testString, testInt});
    }
    else
    {
        ... your code here			
    }
}

Generalnew Enum Pin
Dean Goodman10-Mar-05 8:57
Dean Goodman10-Mar-05 8:57 
GeneralRe: new Enum Pin
TylerBrinks10-Mar-05 11:32
TylerBrinks10-Mar-05 11:32 
GeneralGlobal Mouse Hook for XButtons Pin
AnzelVincir10-Mar-05 8:40
AnzelVincir10-Mar-05 8:40 
Generalnew issue - compare data Table Column Pin
lornej10-Mar-05 8:20
lornej10-Mar-05 8:20 
GeneralRe: new issue - compare data Table Column Pin
TylerBrinks10-Mar-05 8:34
TylerBrinks10-Mar-05 8:34 
GeneralRe: new issue - compare data Table Column Pin
lornej10-Mar-05 9:34
lornej10-Mar-05 9:34 
Generalproblem whit date Help Me Pin
kings_110-Mar-05 8:06
kings_110-Mar-05 8:06 
GeneralRe: problem whit date Help Me Pin
TylerBrinks10-Mar-05 8:33
TylerBrinks10-Mar-05 8:33 
GeneralRe: problem whit date Help Me Pin
kings_110-Mar-05 11:15
kings_110-Mar-05 11:15 
GeneralRe: problem whit date Help Me Pin
TylerBrinks10-Mar-05 11:21
TylerBrinks10-Mar-05 11:21 
GeneralRe: problem whit date Help Me Pin
kings_111-Mar-05 7:24
kings_111-Mar-05 7:24 
GeneralCleaning a Place Holder from a class Pin
see0710-Mar-05 6:48
see0710-Mar-05 6:48 
GeneralRe: Cleaning a Place Holder from a class Pin
see0711-Mar-05 11:41
see0711-Mar-05 11:41 
GeneralRe: Cleaning a Place Holder from a class Pin
see0714-Mar-05 5:19
see0714-Mar-05 5:19 
GeneralUse C# for Addin in Excel Pin
Fardoche610-Mar-05 6:37
Fardoche610-Mar-05 6:37 
GeneralRe: Use C# for Addin in Excel Pin
Skynyrd10-Mar-05 6:55
Skynyrd10-Mar-05 6:55 
Generalsmall project on c# Pin
dipesh patel10-Mar-05 6:36
dipesh patel10-Mar-05 6:36 

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.