I have one method called "Appendtxtdata(string value)". in form1.cs and i want to use it in another class abc.cs for write text. i used following code but doesnt work.
Thanku.
in form1.cs.
public void AppendTxtdata(string value)
{
try
{
if (InvokeRequired)
{
this.Invoke(new Action<string>(AppendTxtdata), new object[] { value });
return;
}
txtdata.Text += value;
}
catch { }
}
in abc.cs
public void getdata() // to run server //
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
the getdata method calling in another method and that method is called in form1 in thread.