Help needed with InvokeRequired for Web.UI
Posted
by Ali
on Stack Overflow
See other posts from Stack Overflow
or by Ali
Published on 2010-04-11T15:26:59Z
Indexed on
2010/04/11
15:33 UTC
Read the original article
Hit count: 428
I have a multi-threaded application in C# which tries to write to a TextBox in a Windows.Forms created by another thread.
As threads cannot modify what has not been created by them, I was using InvokeRequired as shown on the code below, to solve this problem.
public delegate void MessageDelegate(Communication message);
void agent_MessageReceived(Communication message)
{
if (InvokeRequired)
{
BeginInvoke(new MessageDelegate(agent_MessageReceived), new object[] { message });
}
else
{
TextBox1.Text += message.Body;
}
}
Now I need to do the same for a TextBox in an ASP.NET app, but apparently neither InvokeRequired nor BeginInvoke exist for TextBox in a Web.UI. What can I do?
© Stack Overflow or respective owner