VB.NET + MDI

P

Piotr Rendaszka

Hi All!

I have following problems while working with the VB.NET and MDI forms. I
have a form that is an MDI Parent and some MDI Child forms that are created
by the buttons on the parent form.

The first problem is that I do not really know how to limit the buttons so
they will be able to open only one instance of specific MDI Child form.

The second problem is that I do not know how should I reffer to the
controls/variables that are part of the MDI Child forms. In other words I
cannot simply allow MDI Child forms to exchange data/variables between
eachother.

Can you please help me solving these problems?

Regards,

Piotr
 
C

Cor Ligthert

Piotr,

Maybe you can use this. (watch typos a lot is typed in this message)

\\\
Private Sub mnuFrmHandling(ByVal frmName As String)
For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next
Dim frmNew As Form
Select Case frmName
Case "Persons"
frmNew = New frmPersons
Case "blabla"
frmNew = New frmBlaBla ' and all other forms after that
frmNew.myproperty = "Hello There"
Case Else
frmNew = New frmStandard(frmName)
End Select
frmNew.MdiParent = Me
frmNew.Show()
frmNew.WindowState = FormWindowState.Maximized
frmNew.Name = frmName
frmNew.BringToFront()
End Sub
///

You can find the parent form in a MDI form by using this in the mdi.
me.parent. (You cannot go directly from one MDI class (form) to another MDI
class)

I hope this helps a little bit?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top