Reputation: 131
I have a form1 and form2, in form1 there is a chart which plots dot when i call a method defined in the form1 by using a button, now in form2 when i call a form1's method by passing two parameter to the method of form1 it should display dot in form1's chart , say the parameter is temperature and humidity. I hope there is a way to do this but I don't know this.Any help would be appreciated thanks in advance.
Upvotes: 0
Views: 66
Reputation: 77846
First of all, you should refactor your code and separate that graph plotting method in it's separate class and then you shouldn't face this situation.
In your case, you can have a Form1
instance in your Form2
and using that instance call the method like
Public class Form2 : Form
{
public Form1 frm1 = null;
public Form2(Form1 frm)
{
this.frm1 = frm;
}
protected void btn_click(object sender, EventArgs e)
{
frm1.Plottingmethod();
}
}
Upvotes: 1