Calling method / refreshing data in another form?
So I have 2 forms – frmMain and frmChild
The frmChild form is declared as I run frmMain
frmChild form1 = new frmChild();
I also have a button that runs a method to open the frmChild form.
OpenForm(form1);
The question is, how can I update data/call the desired method on the frmChild form while I’m still on the frmMain form? I need to do it on the existing instance of the form, without creating a new one.
I’ve tried doing it this way, but can’t access the method
The frmMain class
public partial class frmMain: DevExpress.XtraEditors.XtraForm
{
frmChild form1 = new frmChild();
private void UpdateDataOnChildForm()
{
form1.DoStuff(); // cant access this method...
}
}
The frmChild class
public partial class frmChild : DevExpress.XtraEditors.XtraForm
{
public void UpdateData()
{
//update data here...
}
}
Ms Ark
public partial class MainForm : Form
{
private void btnMain_Click(object sender, EventArgs e)
{
LoginForm lfrm = new LoginForm;
LoginForm.ShowDialog();
}
private void SecureMethod(){//do sth};
}
public partial class LoginForm : Form
{
private void btnok_Click(object sender, EventArgs e)
{
SecureMethod(); //is not true
this.close(); //close loginform
}
}`