Hi,
Ok, i've tested. Just this code you posted earlier works fine for me
CODE
frmChild.MdiParent = me
frmChild.show
Sorry for giving you the wrong info on Controls.Add(). I seldom use MDI for my software. I find it confusing.
Anyway, you also need to enable "KeyPreview" (Misc) for your main form for the keyboard event to work properly.
After seeing you code, i do have a few comment for you
CODE
Dim response As Microsoft.VisualBasic.MsgBoxResult
Use this instead of interger, that way your code of
CODE
If response = 6 Then
can be written as
CODE
If response = MsgBoxResult.Yes Then
which is a lot of easier to read and debug
The 2nd thing is try to use as much OOP strategy as possible. One of it is keep all this code that show your MDI Child in side one function, then call the function from those menu and key event. That way, it's easier to maintain the code. If you need to change the way your Help Windows appear, just change that function. All those event that call the function gets the changes. f not, you'll have to look through all your codes to make the changes, and you might miss it, trust me, it does, all the time
Instead of
CODE
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Dim response As Microsoft.VisualBasic.MsgBoxResult
Select Case e.KeyCode
Case Keys.F1
MsgBox("You asked for help")
Exit Sub
Case Keys.F2
frmWebHelp.MdiParent = Me
frmWebHelp.Show()
..... more code
Private Sub WebHelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebHelpToolStripMenuItem.Click
frmWebHelp.MdiParent = Me
frmWebHelp.Show()
End Sub
You change it to
CODE
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Dim response As Microsoft.VisualBasic.MsgBoxResult
Select Case e.KeyCode
Case Keys.F1
MsgBox("You asked for help")
Exit Sub
Case Keys.F2
ShowfrmWebHelp()
..... more code
Private Sub WebHelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WebHelpToolStripMenuItem.Click
ShowfrmWebHelp()
End Sub
Private Sub ShowfrmWebHelp()
frmWebHelp.MdiParent = Me
frmWebHelp.Show()
End Sub
VB.Net implemented a lot of OOP features compare to VB6, it's totally re-engineered, thus why not use that to our fullest
All the best
Regards
Faulty
Comment/Reply (w/o sign-up)