Jump to content
mateusbier

Problemas para abrir form dentro de um mdiParent

Recommended Posts

mateusbier

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

Share this post


Link to post
Share on other sites
mateusbier

Apenas tenho esse código para abrir o form2. Sou iniciante no vb.

Form2.MdiParent = Me
    Form2.Show()

Edited by thoga31
GeSHi + formatação do post

Share this post


Link to post
Share on other sites
NunoDinis

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

Share this post


Link to post
Share on other sites
samesdavis

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

Share this post


Link to post
Share on other sites
prokton

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.