Jump to content

Problemas para abrir form dentro de um mdiParent


mateusbier

Recommended Posts

Olá senhores. Eu criei um projeto onde tenho um mdiParent. Quero abrir forms dentro dele, porém, quando abro um novo formulário, o design do mdiParent aparece nele.

Tem como resolver isso ?

vb01n.jpg

Isso que ocorre.

vb02.jpg

Edited by thoga31
Formatação do tópico
Link to post
Share on other sites
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 post
Share on other sites

Outra sugestão seria dessa forma:

No evento clique do botão ou menustrip do mdiform, coloque

form2.show

No evento load do form2 coloque

MdiParent = Frm_MenuPrincipal

obs.: sendo que o nome "Frm_MenuPrincipal" é o nome do seu mdiform

Edited by samesdavis
Link to post
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 post
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.