Click here to Skip to main content
15,909,651 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# coding standards Pin
GuyThiebaut6-Oct-07 8:19
professionalGuyThiebaut6-Oct-07 8:19 
GeneralRe: C# coding standards Pin
pmarfleet6-Oct-07 8:26
pmarfleet6-Oct-07 8:26 
GeneralRe: C# coding standards Pin
Scott Dorman7-Oct-07 10:43
professionalScott Dorman7-Oct-07 10:43 
AnswerRe: C# coding standards Pin
Guffa6-Oct-07 9:40
Guffa6-Oct-07 9:40 
GeneralRe: C# coding standards Pin
GuyThiebaut6-Oct-07 10:06
professionalGuyThiebaut6-Oct-07 10:06 
AnswerRe: C# coding standards Pin
Scott Dorman7-Oct-07 10:46
professionalScott Dorman7-Oct-07 10:46 
GeneralRe: C# coding standards Pin
GuyThiebaut7-Oct-07 10:55
professionalGuyThiebaut7-Oct-07 10:55 
QuestionInvoke Bug??? Pin
udikantz6-Oct-07 6:32
udikantz6-Oct-07 6:32 
i got a realy strange issue with invoking code on a multi threaded application , it happens on thins function below:


<br />
private void closeForm()<br />
{<br />
            if (this.InvokeRequired)<br />
            {<br />
                ShowFormCallback d = new ShowFormCallback(closeForm);<br />
                this.Invoke(d, new object[] {});<br />
            }<br />
            else<br />
            {<br />
                 try<br />
                 {<br />
                      goform.Close();<br />
                 }<br />
                 catch(Exception e)<br />
                 {             <br />
                     Console.WriteLine("Cant close the damn form " + e.Message);<br />
                 }<br />
            }<br />
            <br />
        }<br />
      <br />
}<br />



The Error is:
"Cross-thread operation not valid: Control 'player2' accessed from a thread other than the thread it was created on."

although on debug i see that when the closeForm() is executed
this.InvokeRequired has a "false" value.
and yet when the line: "goform1.Close();" is executed i get cross-thread operation not valid.

how is this possible, i have used this technique (given by the MSDN) in order to avoid such errors several times and never had problem with it,

so what could be the cause of such a thing?


Net

AnswerRe: Invoke Bug??? Pin
lmoelleb6-Oct-07 6:36
lmoelleb6-Oct-07 6:36 
GeneralRe: Invoke Bug??? Pin
udikantz6-Oct-07 6:45
udikantz6-Oct-07 6:45 
QuestionOperator Overloading Pin
sinha@c#6-Oct-07 6:12
sinha@c#6-Oct-07 6:12 
AnswerRe: Operator Overloading Pin
lmoelleb6-Oct-07 6:24
lmoelleb6-Oct-07 6:24 
AnswerRe: Operator Overloading Pin
Pete O'Hanlon7-Oct-07 10:38
mvePete O'Hanlon7-Oct-07 10:38 
AnswerRe: Operator Overloading Pin
Scott Dorman7-Oct-07 10:47
professionalScott Dorman7-Oct-07 10:47 
QuestionHow to determine best possible combination to a C# ListArray? Pin
humblepgmr6-Oct-07 4:10
humblepgmr6-Oct-07 4:10 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
humblepgmr6-Oct-07 4:47
humblepgmr6-Oct-07 4:47 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
Guffa6-Oct-07 6:25
Guffa6-Oct-07 6:25 
AnswerRe: How to determine best possible combination to a C# ListArray? Pin
lmoelleb6-Oct-07 6:33
lmoelleb6-Oct-07 6:33 
QuestionFinalize and Dispose Pin
Blumen6-Oct-07 2:29
Blumen6-Oct-07 2:29 
AnswerRe: Finalize and Dispose Pin
Simon P Stevens6-Oct-07 2:47
Simon P Stevens6-Oct-07 2:47 
GeneralRe: Finalize and Dispose Pin
Blumen6-Oct-07 3:39
Blumen6-Oct-07 3:39 
AnswerRe: Finalize and Dispose Pin
Guffa6-Oct-07 4:12
Guffa6-Oct-07 4:12 
AnswerRe: Finalize and Dispose Pin
Abhijit Jana6-Oct-07 2:49
professionalAbhijit Jana6-Oct-07 2:49 
AnswerRe: Finalize and Dispose Pin
Scott Dorman7-Oct-07 10:52
professionalScott Dorman7-Oct-07 10:52 
QuestionTree View Manipulation. Pin
M. J. Jaya Chitra6-Oct-07 1:50
M. J. Jaya Chitra6-Oct-07 1:50 

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.