i have 2 script 1- Soket.cs (Soket Server Working with thread) FormMain.cs(Working Normal) i call a function in FormMain from soket.cs with this code :
public void ResiveFunc(string FuncResive)
{
string FuncName = "";
string FuncValue = "";
for (int i = 0; i <= 2; i++)
{
FuncName += FuncResive[i];
}
for (int j = 4; j <= FuncResive.Length - 1; j++)
{
FuncValue += FuncResive[j];
}
MessageBox.Show(FuncName);
MessageBox.Show(FuncValue);
if (FuncName == "TAB")
{
Form1 mainForm = new Form1();
mainForm.AdverFilter(FuncValue);
}
}
i call this AdverFilter() function in FormMain :
public void AdverFilter(string value)
{
if (this.InvokeRequired)
{
this.BeginInvoke(new Action<string>(AdverFilter),value);
}
else
{
this.richTextBox1.Text = value;
MessageBox.Show("AdverFilter(string value)");
MessageBox.Show(this.richTextB开发者_如何转开发ox1.Text);
}
}
but its dont work!!! Messagebox show fine the value but richtextbox.text is null in GUI (after the function is ended)... please tell me how can i fix this problem...!?
send a string clone:
mainForm.AdverFilter(FuncValue.Clone());
this.BeginInvoke(new Action<string>(AdverFilter),value.Clone());
精彩评论