mateusbier Posted February 14, 2013 at 12:08 PM Report #495242 Posted February 14, 2013 at 12:08 PM 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 ? http://img19.imageshack.us/img19/7779/vb01n.jpg Isso que ocorre. http://img203.imageshack.us/img203/853/vb02.jpg
NunoDinis Posted February 14, 2013 at 12:21 PM Report #495243 Posted February 14, 2013 at 12:21 PM Mostra o código sff... Estranha forma de vida que tem a capacidade de transformar comandos em mensagens de erro. ndsotware.org
mateusbier Posted February 14, 2013 at 12:24 PM Author Report #495244 Posted February 14, 2013 at 12:24 PM (edited) Apenas tenho esse código para abrir o form2. Sou iniciante no vb. Form2.MdiParent = Me Form2.Show() Edited February 14, 2013 at 10:47 PM by thoga31 GeSHi + formatação do post
NunoDinis Posted February 14, 2013 at 12:54 PM Report #495249 Posted February 14, 2013 at 12:54 PM 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
samesdavis Posted February 16, 2013 at 02:58 PM Report #495557 Posted February 16, 2013 at 02:58 PM (edited) 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 February 16, 2013 at 02:59 PM by samesdavis
prokton Posted February 22, 2013 at 12:24 PM Report #496626 Posted February 22, 2013 at 12:24 PM 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now