I am working on a windows forms app in which I want to communicate a child form with a parent form. The implementation that I have for this purpose is the following:
Interface
public interface IActualizarDGVPrincipal
{
void AcualizarDGV();
}
This interface is implemented in the parent form, which becomes my MDI form.
The method is called from the child form, which is a user control:
public IActualizarDGVPrincipal Opener { get; set; }
private void Actualizar()
{
Opener.AcualizarDGV();
}
At the moment of calling the method, it gives me an error of reference to an object not established as an instance of an object.
I am using ninject, and I call the son formulrio from the father as follows:
private void btnMenuCategoria_Click(object sender, EventArgs e)
{
ActivarTitulos(true, strSubCategoria.nameEntity);
var argCall = new ConstructorArgument("this", this);
var categoria = CompositionRoot.Resolve<ucCategoria>(argCall);
categoria.DGVCategoria += Categoria_DGVCategoria;
categoria.DGVSubCategoria += Categoria_DGVSubCategoria;
categoria.CategoriaClose += Categoria_CategoriaClose;
this.CurrentControl = categoria;
CargarDGVPrincipal(AsignacionTablas.SubCategoria);
}
That's where I must pass the instanced parameter to have no problems in the child form when I call it. Any suggestions to solve it?