I have very basic question, but I don't find the solution.
I have MAIN PROGRAM (maybee this is not a good name) and two form.
In this MAIN PROGRAM I call Form2. With button in Form2 I call Form1. Now I want to call method PS of MAIN PROGRAM with button in Form1
MAIN PROGRAM:
namespace Example.csproj
{
public partial class SolidWorksMacro
{
public Form1 RWindow = new Form1();
public Form2 BWindow = new Form2();
public void Main()
{
BWindow.ShowDialog();
}
public void PS()
{
MessageBox.Show("WORKING");
}
public SldWorks swApp;
}
}
FORM2:
namespace Example.csproj
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 frm = new Form1();
frm.Show();
this.Close();
}
}
}
FORM1:
namespace Example.csproj
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Therefore which is the best/simple way to call method PS with button from Form1.