S
Steven C
Hello:
I've seen several recent threads on this, but I'm still not clear how
to reference a *method* on one form from another. I want to add a
customer in the child form, and then update the customers grid in the
parent form.
frmCustomers is the parent, and frmAddCustomer is the child. In
frmCustomers, when the user clicks the ADD commandbutton, I call this
code:
private void cmdAdd_Click(object sender, System.EventArgs e)
{
Conferro.Forms.frmAddCustomer.frmAddCustomer
frmAddCustomer = new
Conferro.Forms.frmAddCustomer.frmAddCustomer();
frmAddCustomer.p_ofrmCustomers = this;
frmAddCustomer.Show();
}
And in the frmAddCustomer form, I have a public property set up as
follows:
public object p_ofrmCustomers
{
get
{
return p_ofrmCustomers;
}
set
{
object p_ofrmCustomers = value;
}
}
I'm then trying to call the m_refreshcustomersgrid() method as
follows, to refresh the grid on the parent, and then release the child
form:
public void DisposeForm()
{
this.p_ofrmCustomers.m_refreshcustomersgrid(); <==
this.Dispose();
}
This doesn't work. I get the "object does not contain definition"
error on compile.
What am I doing wrong here? Sorry, newbie question. In Foxpro, this
is easy, as there is an implicit reference to any instantiated object.
Thanks!
Steven
I've seen several recent threads on this, but I'm still not clear how
to reference a *method* on one form from another. I want to add a
customer in the child form, and then update the customers grid in the
parent form.
frmCustomers is the parent, and frmAddCustomer is the child. In
frmCustomers, when the user clicks the ADD commandbutton, I call this
code:
private void cmdAdd_Click(object sender, System.EventArgs e)
{
Conferro.Forms.frmAddCustomer.frmAddCustomer
frmAddCustomer = new
Conferro.Forms.frmAddCustomer.frmAddCustomer();
frmAddCustomer.p_ofrmCustomers = this;
frmAddCustomer.Show();
}
And in the frmAddCustomer form, I have a public property set up as
follows:
public object p_ofrmCustomers
{
get
{
return p_ofrmCustomers;
}
set
{
object p_ofrmCustomers = value;
}
}
I'm then trying to call the m_refreshcustomersgrid() method as
follows, to refresh the grid on the parent, and then release the child
form:
public void DisposeForm()
{
this.p_ofrmCustomers.m_refreshcustomersgrid(); <==
this.Dispose();
}
This doesn't work. I get the "object does not contain definition"
error on compile.
What am I doing wrong here? Sorry, newbie question. In Foxpro, this
is easy, as there is an implicit reference to any instantiated object.
Thanks!
Steven