@CSharpNoob2011:
To solve this with a thread, you can:
1) Start a thread to store the original text contents.
2) Check whether time is over.
3) If yes, just call Invoke or BeginInvoke (BeginInvoke is used when you wanna do the things after "assignment to the textbox" but nothing to do with "assignment" itself.
Sample:
//In your button's click codes
InvokeMe(TextBox1.Text);
private static void InvokeMe(string content)
{
int seconds = -1;
int minutes = 0;
Thread th = new Thread(()=>{
++seconds;
if(seconds>=59)
{
seconds = 0;
minutes++;
}
if(minutes==5)
{
minutes = 0;
seconds = 0;
this.Invoke(new MethodInvoker(()=>{
TextBox1.Text +=……;
},null);
}
Thread.Sleep(1000);
});
}
ASP.NET Forum
Other Discussion Forums
FreeRice Donate
Issues to report
Free Tech Books Search and Download
No comments:
Post a Comment