public void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
f1.DrawString();
}
All the rest is as generated by the IDE.
The button click works fine, but it does not call DrawString () method.
public void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
f1.DrawString();
}
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Posted Sep 26, 2010, 11:17 AM EDT
You don't have to create an object for methods inside the same class....Just call DrawString()..it would work fine...
I also want u to check whether the method is inside the same class as told by u....
With Regards
P.Krishna Prasad
JureRank #2,128 · 670 reputationPosted Sep 27, 2010, 4:14 PM EDT
Add this lambda expression to your button-click method
this.Paint += (object o, PaintEventArgs e) => {
e.Graphics.DrawString(/*...*/);
e.Graphics.Draw...
...
};