Public Sub Main()
Dim frm As New frmMDI
frm.Show()
End Sub
I used the above code in module.
In VB it opens the MDI and stays.
In .Net it doesn't open and stay. Application terminates immediately after doing some process.
Pls help.
Printable View
Public Sub Main()
Dim frm As New frmMDI
frm.Show()
End Sub
I used the above code in module.
In VB it opens the MDI and stays.
In .Net it doesn't open and stay. Application terminates immediately after doing some process.
Pls help.
Yes Show doesn't hold the thread open you can either use ShowDialog or Application.Run(New frmMDI).
Thanks. It worked.
How do I restrict a form to be opened multiple times.
'Restrict it to open multiple times', What do you mean?
Dim frm As New Form1
frm.MdiParent = Me
frm.Show()
If I use the above, it opens the form every time I call. But I want it to check whether the form is already open.
I don't want multiple instances of same Form.
Do you mean restrict a form to only one instance?
Yes
Single instance of your app or just that form?
If you mean form then this should get you started: http://www.vbforums.com/showthread.p...hreadid=126418
Then you could do something like create the for variable a global (dim myFrm as Form1) and then before you create it when needed, you can check to see if myFrm = Nothing. If it is then go ahead and create the one instance. If <> Nothing then either close it and re-open it, do nothing, or set focus to the instance already in existence.
VB Code:
Dim myFrm As Form1 'Make this a class variable If myFrm Is Nothing Then 'No instance of the form yet myFrm = New Form1 myFrm.Show() 'or show dialog Else 'Instance already exists so take appropriate action here End If
Oh, MDI - the link posted by Edneeis will be of more use then :D
Cool. It works.