Click here to Skip to main content
15,891,766 members
Home / Discussions / C#
   

C#

 
GeneralPausing thread untill asynchronous operation finishes. Pin
N a v a n e e t h26-Feb-08 23:28
N a v a n e e t h26-Feb-08 23:28 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
Martin#26-Feb-08 23:47
Martin#26-Feb-08 23:47 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
N a v a n e e t h27-Feb-08 0:00
N a v a n e e t h27-Feb-08 0:00 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
buchstaben27-Feb-08 0:49
buchstaben27-Feb-08 0:49 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
N a v a n e e t h27-Feb-08 1:00
N a v a n e e t h27-Feb-08 1:00 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
Bekjong27-Feb-08 1:35
Bekjong27-Feb-08 1:35 
AnswerRe: Pausing thread untill asynchronous operation finishes. Pin
telha27-Feb-08 1:27
telha27-Feb-08 1:27 
GeneralRe: Pausing thread untill asynchronous operation finishes. Pin
pbraun27-Feb-08 9:14
pbraun27-Feb-08 9:14 
GeneralAuto Run Procedures In Windows App Pin
GermanDM26-Feb-08 23:05
GermanDM26-Feb-08 23:05 
GeneralRe: Auto Run Procedures In Windows App Pin
jowecape27-Feb-08 1:07
jowecape27-Feb-08 1:07 
GeneralRe: Auto Run Procedures In Windows App Pin
GermanDM27-Feb-08 1:19
GermanDM27-Feb-08 1:19 
GeneralRe: Auto Run Procedures In Windows App Pin
buchstaben27-Feb-08 1:10
buchstaben27-Feb-08 1:10 
GeneralRe: Auto Run Procedures In Windows App Pin
GermanDM27-Feb-08 1:20
GermanDM27-Feb-08 1:20 
GeneralCross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
NarVish26-Feb-08 23:00
NarVish26-Feb-08 23:00 
AnswerRe: Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
Martin#26-Feb-08 23:11
Martin#26-Feb-08 23:11 
Hello,

As the error message says it all.

Here is a solution using "InvokeRequired" and "Invoke" (google it)
private void threadStartServer()
{
    string result = "";
    TcpListener tcpListener1 = new TcpListener(8080);
    tcpListener1.Start();
 
    EditButtonText("Success");
}
 
private delegate void EditButtonTextDelegate(string strArg);
 
private void EditButtonText(string actText)
{
    if(InvokeRequired)
    {
        Invoke(new EditButtonTextDelegate(EditButtonText), new object[] {actText});
	return;
    }

    button1.Text = actText;
}


Hope it helps!

All the best,

Martin

GeneralRe: Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
NarVish26-Feb-08 23:36
NarVish26-Feb-08 23:36 
GeneralRe: Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
N a v a n e e t h26-Feb-08 23:41
N a v a n e e t h26-Feb-08 23:41 
GeneralRe: Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
NarVish26-Feb-08 23:37
NarVish26-Feb-08 23:37 
GeneralRe: Cross-thread operation not valid: Control 'button1' accessed from a thread other than the thread it was created on. Pin
N a v a n e e t h26-Feb-08 23:25
N a v a n e e t h26-Feb-08 23:25 
GeneralCreating 1D image in C#.NET Pin
D i x y26-Feb-08 22:58
D i x y26-Feb-08 22:58 
GeneralRe: Creating 1D image in C#.NET Pin
Colin Angus Mackay26-Feb-08 23:23
Colin Angus Mackay26-Feb-08 23:23 
JokeRe: Creating 1D image in C#.NET Pin
Malcolm Smart27-Feb-08 2:32
Malcolm Smart27-Feb-08 2:32 
GeneralRe: Creating 1D image in C#.NET Pin
Mark Churchill27-Feb-08 3:04
Mark Churchill27-Feb-08 3:04 
Questionsending a mail using remoting Pin
puneet.priyadarshi26-Feb-08 22:51
puneet.priyadarshi26-Feb-08 22:51 
GeneralRe: sending a mail using remoting Pin
Nouman Bhatti27-Feb-08 1:31
Nouman Bhatti27-Feb-08 1:31 

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.