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.
Raja TRank #685 · 3.5K reputationPosted Jul 14, 2015, 10:59 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 14, 2015, 11:03 PM EDT
http://stackoverflow.com/questions/8206810/object-reference-not-set-to-an-instance-of-an-object
Member1141 reputationPosted Jul 15, 2015, 12:11 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 15, 2015, 12:59 AM EDT
Member1141 reputationPosted Jul 15, 2015, 1:30 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 15, 2015, 1:40 AM EDT
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");
}
Member1141 reputationPosted Jul 15, 2015, 1:46 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 19, 2015, 9:25 PM EDT
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
{
Form1 f = new Form1();
f.AppendTxtdata("data sent");
}
Raja TRank #685 · 3.5K reputationPosted Jul 19, 2015, 9:27 PM EDT
Member1141 reputationPosted Jul 19, 2015, 10:38 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 19, 2015, 10:44 PM EDT
{
try
{
if (InvokeRequired)
{
this.Invoke(new Action
return;
}
txtdata.Text += value;
}
catch { }
}
Raja TRank #685 · 3.5K reputationPosted Jul 19, 2015, 10:50 PM EDT
Member1141 reputationPosted Jul 19, 2015, 10:58 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 19, 2015, 11:28 PM EDT
Member1141 reputationPosted Jul 19, 2015, 11:57 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 20, 2015, 4:09 AM EDT
Member1141 reputationPosted Jul 26, 2015, 8:34 PM EDT
Member1141 reputationPosted Jul 26, 2015, 8:39 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 26, 2015, 8:44 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 26, 2015, 8:47 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 26, 2015, 8:51 PM EDT
Member1141 reputationPosted Jul 26, 2015, 10:51 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 26, 2015, 11:10 PM EDT
Member1141 reputationPosted Jul 26, 2015, 11:43 PM EDT
Member1141 reputationPosted Jul 26, 2015, 11:44 PM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 26, 2015, 11:46 PM EDT
Member1141 reputationPosted Jul 27, 2015, 1:34 AM EDT
Raja TRank #685 · 3.5K reputationPosted Jul 27, 2015, 1:54 AM EDT
Member1141 reputationPosted Jul 27, 2015, 2:14 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts