Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I'm making a MDI based application, but I have no clue on how to open one MDI Child 1 time only, I'm using Main Sub Startup mode, and I'm using the following code to show the Child:

 

This code its into a menu item click, inside the MDI Parent Form

Dim SelFrm as Form

SelFrm = New frmChild
SelFrm.SetParent = Me
SelFrm.Show

 

The problem is when I click the MenuItem a new form its opened instead of set the focus to the current one opened (if its an opened previously)

 

Any help its good !!

 

Thanks

 

Mike

Mikecrosoft.Net
Posted

I had this problem and got round it by having a variable in the parent form which is set True when the child opens. The if it is True on subsequent clicks it does nothing.

 

Remember to set to false on close tho:)

My website
Posted

Thanks my friends, all the ideas are good, but I forgot something, my program logic its usinf the SelFrm as a variable that opens the selected child form depending the Menu Item selected.

 

Dim SelFrm as Form

Select Case MenuItem.Text

Case "Menu1"
  SelFrm = New Form1

Case "Menu2"
 SelFrm = New Form2

......


End Select

 

May be this is the wrong way but I need it like this.

 

Thanks

Mikecrosoft.Net

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.   Paste as plain text instead

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