|
-
Feb 29th, 2004, 11:01 PM
#1
Thread Starter
New Member
i have some problem pls help
when i run form from sub Main()
it'll show and disappear in a second.
i have created the object of the form
and use the methon show()
and it does't work
-
Feb 29th, 2004, 11:28 PM
#2
You have to hold the thread open so you can either use ShowDialog instead of Show or use Application.Run(formtypehere)
-
Mar 1st, 2004, 04:21 AM
#3
PowerPoster
Hi,
Just to clarify Edneeis's response,
You create the instance of the form in the General section of the Module:
e.g. Public frmMain As New fclsMain
and then create the following Sub Main.
VB Code:
Public Sub Main()
Application.Run(frmMain)
End Sub
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 1st, 2004, 10:57 AM
#4
Just as a note you do not need to declare it in the general section if you don't want you can just assign a new instance in the Application.Run method or just use ShowDialog. Technically you could just call Application.Run() after using Show too, which would hold the thread open but I don't want to confuse you.
VB Code:
Public Sub Main
'you can do this
Application.Run(New frmMain)
'or this instead
Dim frm As New frmMain
frm.ShowDialog()
'or what taxes showed you
End Sub
-
Mar 1st, 2004, 11:55 AM
#5
PowerPoster
Hi Edneeis,
" Application.Run(New frmMain)"
I did not know that one! Looks like this is my day for picking your brains.
Am I right in saying all three methods will result in the application closing when frm Main is closed, even though other forms were open at that time?
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 1st, 2004, 12:30 PM
#6
Yes you are right providing there isn't something that would hold things up after the call to Application.Run or ShowDialog. It's all six in one, half a dozen in the other or different ways to do the samething.
-
Mar 3rd, 2004, 02:12 AM
#7
Thread Starter
New Member
thanks for the solutions
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|