Hi guys….I got a problem with MDI (Multiple Document Interfaces). First, I am a newbie, and I need to make a MDI application for study purposes. But somehow, I got stuck. So, this is the problem….
The forms:
frmMyParentForm
frmCommandForm
frmForm3
frmMyParentForm, as its name, it’s the parent form. And frmCommandForm is like a control panel, where user could open frmForm3.
At the frmCommandForm, there is a button named "btnForm3" and its text "Open Form3", which when it’s clicked, it will open the frmForm3. And this is where the problem also…..when it’s click, it will ALWAYS open a new frmForm3, which I don’t want to…..What I want is, if the frmForm3 has been opened before, and the user clicks again the button “btnForm3”, it will make the frmForm3 got focus.
Somehow, I just got stupid, and have no clue how could I do that….luckily, found this forum, with full of hope that someone would help.
Thanks a lot…
Code at frmMyCommandForm for btnOpenForm3
Sincerely,
Chris
The forms:
frmMyParentForm
frmCommandForm
frmForm3
frmMyParentForm, as its name, it’s the parent form. And frmCommandForm is like a control panel, where user could open frmForm3.
At the frmCommandForm, there is a button named "btnForm3" and its text "Open Form3", which when it’s clicked, it will open the frmForm3. And this is where the problem also…..when it’s click, it will ALWAYS open a new frmForm3, which I don’t want to…..What I want is, if the frmForm3 has been opened before, and the user clicks again the button “btnForm3”, it will make the frmForm3 got focus.
Somehow, I just got stupid, and have no clue how could I do that….luckily, found this forum, with full of hope that someone would help.
Thanks a lot…
Code at frmMyCommandForm for btnOpenForm3
VB.NET:
Private Sub btnOpenForm3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenForm3.Click
Try
Dim f3 As frmForm3
If f3 Is Nothing Then
f3 = New frmForm3
End If
With f3
.StartPosition = FormStartPosition.CenterScreen
.MdiParent = MDI.frmmyParentForm.ActiveForm
.Show()
End With
Catch ex As Exception
MsgBox(ex.ToString)
Application.Exit()
End Try
End Sub
Sincerely,
Chris
Last edited: