Jump to content

Problemas para abrir form dentro de um mdiParent


mateusbier

Recommended Posts

Dim abrir As Boolean = True
    For Each Formulario As Form In My.Application.OpenForms
	    If Formulario.Text = "Disciplinas" Then
		    abrir = False
		    Exit For
	    End If
    Next
    If abrir Then
	    Dim janela As New MostrarDisciplina
	    janela.MdiParent = Me
	    janela.Show()
    Else
	    For Each Formulario As Form In My.Application.OpenForms
		    If Formulario.Text = "Disciplinas" Then
			    Formulario.BringToFront()
		    End If
	    Next
    End If

Este código abre o formulário dentro de MDI, e caso o formulário já esteja aberta e escondida, traz-lo para a frente.

Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro.

ndsotware.org

Link to comment
Share on other sites

Eu faço sempre assim:

No form mdiParent:

Public Class FrmPrincipal
Dim frmClientes As New FrmClientes()
Private Sub FrmPrincipal_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
frmClientes.MdiParent =Me
PrivateSub m_Clientes_Click(sender As System.Object, e As System.EventArgs) Handles m_Clientes.Click
frmClientes.Show()
frmClientes.BringToFront()
Depois no Form Child:
Private Sub FrmClientes_FormClosing(...)
e.Cancel = True
Hide()

Nunca fa

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.