Click here to Skip to main content
15,901,666 members
Home / Discussions / C#
   

C#

 
QuestionVisual Studio and .Net Runtime Framework dependency Pin
George_George7-Aug-07 1:56
George_George7-Aug-07 1:56 
AnswerRe: Visual Studio and .Net Runtime Framework dependency Pin
Christian Graus7-Aug-07 2:02
protectorChristian Graus7-Aug-07 2:02 
GeneralRe: Visual Studio and .Net Runtime Framework dependency Pin
George_George7-Aug-07 2:53
George_George7-Aug-07 2:53 
AnswerRe: Visual Studio and .Net Runtime Framework dependency Pin
Hessam Jalali7-Aug-07 3:15
Hessam Jalali7-Aug-07 3:15 
GeneralRe: Visual Studio and .Net Runtime Framework dependency Pin
George_George7-Aug-07 3:53
George_George7-Aug-07 3:53 
QuestionRich Text Box control- help Pin
Hum Dum7-Aug-07 1:54
Hum Dum7-Aug-07 1:54 
AnswerRe: Rich Text Box control- help Pin
Hessam Jalali7-Aug-07 3:25
Hessam Jalali7-Aug-07 3:25 
Questionhow to convert 2005 to 2003 Pin
avinol7-Aug-07 1:46
avinol7-Aug-07 1:46 
AnswerRe: how to convert 2005 to 2003 [modified] Pin
Hessam Jalali7-Aug-07 1:52
Hessam Jalali7-Aug-07 1:52 
Questionhow to validate register user that his validity got end Pin
avinol7-Aug-07 1:39
avinol7-Aug-07 1:39 
AnswerRe: how to validate register user that his validity got end Pin
Chetan Patel7-Aug-07 2:08
Chetan Patel7-Aug-07 2:08 
AnswerRe: how to validate register user that his validity got end Pin
Chintan.Desai7-Aug-07 2:09
Chintan.Desai7-Aug-07 2:09 
QuestionPost a XML file to URL Pin
Kumar Arun7-Aug-07 1:20
Kumar Arun7-Aug-07 1:20 
AnswerRe: Post a XML file to URL Pin
Christian Graus7-Aug-07 1:23
protectorChristian Graus7-Aug-07 1:23 
AnswerRe: Post a XML file to URL Pin
Chintan.Desai7-Aug-07 2:13
Chintan.Desai7-Aug-07 2:13 
Questionprinter Pin
help as an alias7-Aug-07 1:16
help as an alias7-Aug-07 1:16 
AnswerRe: printer Pin
lsconyer7-Aug-07 1:32
lsconyer7-Aug-07 1:32 
GeneralRe: printer Pin
help as an alias7-Aug-07 1:37
help as an alias7-Aug-07 1:37 
AnswerRe: printer Pin
Hessam Jalali7-Aug-07 2:14
Hessam Jalali7-Aug-07 2:14 
QuestionThreadiing Pin
james_dixon_20087-Aug-07 0:27
james_dixon_20087-Aug-07 0:27 
AnswerRe: Threadiing Pin
Christian Graus7-Aug-07 0:42
protectorChristian Graus7-Aug-07 0:42 
GeneralRe: Threadiing Pin
james_dixon_20087-Aug-07 1:28
james_dixon_20087-Aug-07 1:28 
GeneralRe: Threadiing Pin
Tristan Rhodes7-Aug-07 2:04
Tristan Rhodes7-Aug-07 2:04 
GeneralRe: Threadiing Pin
james_dixon_20087-Aug-07 3:00
james_dixon_20087-Aug-07 3:00 
GeneralRe: Threadiing Pin
pbraun7-Aug-07 4:44
pbraun7-Aug-07 4:44 
I see some problems in your code.

1. What happens when you hit the start button a few times without waiting for the thread to finish.

2. Invoking the delegate from the thread does work from your thread, but this method requires that each object calling to the new_try() method know about the delegate and call that.

3. If the new_try() method is called from any other thread than the GUI thread, it will take time to execute the call.

The new_try() method should take the form of

public delegate void new_try_delegate();
new_try_delegate newTryEvent = new new_try_delegate(new_try);

public void new_try()
{
   if (this.InvokeRequired)
   {
      Invoke.Begin( newTryEvent );
   }
   else
   {
      textBox1.Text += "This is new Thread" + Environment.NewLine;
   }
}


Now you can call new_try() from any other thread and the GUI thread will do the work of displaying the string.

As for the first problem, you should always check to see if the thread is running before starting another instance of that thread so that the user doesn't run themselves out of resources.

Phil

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.