cerrar un formulario

24/06/2005 - 09:06 por Anonimo | Informe spam
Hola a todos !!!! tengo un problema y es que llamo a un formulario desde
otro con el codigo siguiente

if (this.camOF==null)
{
this.camOF=new CambioOF();
this.camOF.Identificador=this.Identificador;
}
.
..
if (camOF.ShowDialog()==DialogResult.OK)

DESPUES DENTRO DE ESE FORMULARIO EN EL LOAD TENGO UN POSICIONAMIENTO A UN
CONTROL DTERMINADO CON EL FOCUS()

this.OFSelec.Focus();

SIN EMBARLO LA PRIMERA VEZ QUE LO HAGO LO HACE BIEN, PERO DESPUES DE CERRAR
EL FORMULARIO SI VUELVO A ENTRAR ME POSICIONA EL FOCO EN EL ULTIMO CONTROL
QUE LO TENIA Y ESO QUE SE VE QUE PASA POR EL this.OFSelec.Focus()

TIENE ESTO SOLUCION PARA QUE SE POSICIONE SIEMPRE EN EL CONTROL QUE YO LE
MANDO ???

SALUDOS Y GRACIAS
 

Leer las respuestas

#1 Miguel Angel Campos
24/06/2005 - 10:15 | Informe spam
Prueba con this.ActiveControl = this.OFSelec.
Según la MSDN para que se pueda establecer en foco en un control mediante
Focus se deben dar una serie de situaciones, pues alguna de ellas no se da
durante el evento Load del formulario, pero no se exactamente cual.

Un Saludo,

Miguel Angel Campos
MCAD.NET

escribió en el mensaje
news:
Hola a todos !!!! tengo un problema y es que llamo a un formulario desde
otro con el codigo siguiente

if (this.camOF==null)
{
this.camOF=new CambioOF();
this.camOF.Identificador=this.Identificador;
}
.
..
if (camOF.ShowDialog()==DialogResult.OK)

DESPUES DENTRO DE ESE FORMULARIO EN EL LOAD TENGO UN POSICIONAMIENTO A UN
CONTROL DTERMINADO CON EL FOCUS()

this.OFSelec.Focus();

SIN EMBARLO LA PRIMERA VEZ QUE LO HAGO LO HACE BIEN, PERO DESPUES DE
CERRAR
EL FORMULARIO SI VUELVO A ENTRAR ME POSICIONA EL FOCO EN EL ULTIMO CONTROL
QUE LO TENIA Y ESO QUE SE VE QUE PASA POR EL this.OFSelec.Focus()

TIENE ESTO SOLUCION PARA QUE SE POSICIONE SIEMPRE EN EL CONTROL QUE YO LE
MANDO ???

SALUDOS Y GRACIAS


Preguntas similares