
Abrir un form desde otro
Publicado por Adan (4 intervenciones) el 15/09/2014 18:33:03
Como puedo evaluar si el segundo form que necesito abrir ya esta abierto?
Valora esta pregunta


0
private void btnAgregar_Click(object sender, EventArgs e)
{
try
{
ctrCliente cliente = new ctrCliente();
frmClienteManager X = new frmClienteManager();
X.mostrarPantalla(this, baseEntityQuery);
this.SetLimpiarGrid();
this.setGrid();
}
catch (Exception _e)
{
MessageBox.Show(this
, _e.Message
, JavierGuadalupeLV.View.Properties.Resource.TIT_VERIFICAR
, MessageBoxButtons.OK
, MessageBoxIcon.Error
);
}
}
public void mostrarPantalla(Form _parent, CliCliente _baseEntity)
{
baseEntity = _baseEntity ?? new CliCliente();
this.idCliente = (baseEntity != null) ? this.baseEntity.Id : 0;
this.setInformacion(this.idCliente);
if (baseEntity.Id != 0)
{
this.setLoadInformation();
}
this.ShowDialog(_parent);
}
formhijo fh= new formhijo ();
private void click_abrir(object sender ,EventArgs e)
{
if(fh.Isdipused || fh==null ) // esto evalua si el form ya esta abierto o no
{
fh= new formhijo (); // si no esta creado el form lo crea d nuevo
}
fh.MDiparent=this;
fh.Show(); // por el caso contrario lo vuelve a llamar al mismo form
fh.BritFront();
}