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
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.
Member1Posted Jul 27, 2015, 6:14 AM
Raja TPosted Jul 27, 2015, 5:54 AM
Member1Posted Jul 27, 2015, 5:34 AM
Raja TPosted Jul 27, 2015, 3:46 AM
Member1Posted Jul 27, 2015, 3:44 AM
Member1Posted Jul 27, 2015, 3:43 AM
Raja TPosted Jul 27, 2015, 3:10 AM
Member1Posted Jul 27, 2015, 2:51 AM
Raja TPosted Jul 27, 2015, 12:51 AM
Raja TPosted Jul 27, 2015, 12:47 AM
Raja TPosted Jul 27, 2015, 12:44 AM
Member1Posted Jul 27, 2015, 12:39 AM
Member1Posted Jul 27, 2015, 12:34 AM
Raja TPosted Jul 20, 2015, 8:09 AM
Member1Posted Jul 20, 2015, 3:57 AM
Raja TPosted Jul 20, 2015, 3:28 AM
Member1Posted Jul 20, 2015, 2:58 AM
Raja TPosted Jul 20, 2015, 2:50 AM
Raja TPosted Jul 20, 2015, 2:44 AM
{
try
{
if (InvokeRequired)
{
this.Invoke(new Action
return;
}
txtdata.Text += value;
}
catch { }
}
Member1Posted Jul 20, 2015, 2:38 AM
Raja TPosted Jul 20, 2015, 1:27 AM
Raja TPosted Jul 20, 2015, 1:25 AM
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
Member1Posted Jul 15, 2015, 5:46 AM
Raja TPosted Jul 15, 2015, 5:40 AM
public void AppendTxtdata(string value)
{
try
{
if (InvokeRequired)
{
this.Invoke(new Action
return;
}
txtdata.Text += value;
}
catch { }
}
public void getdata() // to run server //
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
Member1Posted Jul 15, 2015, 5:30 AM
Raja TPosted Jul 15, 2015, 4:59 AM
Member1Posted Jul 15, 2015, 4:11 AM
Raja TPosted Jul 15, 2015, 3:03 AM
http://stackoverflow.com/questions/8206810/object-reference-not-set-to-an-instance-of-an-object
Raja TPosted Jul 15, 2015, 2:59 AM