giving focus back to MDIchild window

  • Thread starter Vlado J. \(www.excelleinc.com\)
  • Start date
V

Vlado J. \(www.excelleinc.com\)

Hi,

I have a MDI parent form that opens form as MDIChildren.

I'm trying to check if form is already opened and if it is to give it focus.
I keep getting error messages and no matter what I try it's not sending it
to fornt.

I'm using this code:
Private Sub mnuUserManagement_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles mnuUserManagement.Click

Dim IsMDIExisting As Boolean = False

For Each mdic As Form In Me.MdiChildren

If mdic.Name = "usermanagement" Then IsMDIExisting = True

Next

If IsMDIExisting = False Then

Dim frmUserManagement As New usermanagement

frmUserManagement.MdiParent = Me

frmUserManagement.WindowState = FormWindowState.Maximized

frmUserManagement.Show()

Else

Dim frmUserManagement6 As usermanagement

MessageBox.Show("activateform")

frmUserManagement6.Focus()

End If

End Sub

BTW I know that it finds if it's open because MessageBox pops up.

Thanks in advance,

Vlado
 
T

TCORDON

off the top of my head....

Maby you could use:
Me.ActivateMDIChild(frmUserManagement6)

Good Luck
 
V

Vlado J. \(www.excelleinc.com\)

Didn't help but thanks anyways.


TCORDON said:
off the top of my head....

Maby you could use:
Me.ActivateMDIChild(frmUserManagement6)

Good Luck
 

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