|
-
Apr 3rd, 2003, 11:20 AM
#1
Thread Starter
Frenzied Member
Try Catch Block Inside of Sub Main
When this code runs, all the errors in the forms are handled by the Try Catch of Sub Main. How can I avoid this?
VB Code:
Module Start
Sub Main()
Try
' some code here
Application.Run(New Form1())
Catch ex as System.Exception
Messagebox.Show(ex.Message)
End Try
End Sub
End Module
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 3rd, 2003, 11:48 AM
#2
Frenzied Member
Remove the Application.Run method from the try block.
Dont gain the world and lose your soul
-
Apr 3rd, 2003, 11:51 AM
#3
by try catching in other routines being called. If an error happens down the stack and there is no try catch where it happens, the error will be sent back up thew stack until it finds a try catch.
-
Apr 3rd, 2003, 11:52 AM
#4
Thread Starter
Frenzied Member
You mean i should do this?
VB Code:
Dim frm As New Form1()
frm.ShowDialog()
I thought there is a difference between this one and Application.Run method regarding the life cycle of the application.
Last edited by Lunatic3; Apr 3rd, 2003 at 01:22 PM.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 3rd, 2003, 11:54 AM
#5
Thread Starter
Frenzied Member
Thanks Cander for technical definision of the situation
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Apr 3rd, 2003, 12:07 PM
#6
-
Apr 3rd, 2003, 12:46 PM
#7
Sleep mode
Originally posted by Lunatic3
You mean i should do this?
VB Code:
Dim frm As New Form1()
frm.Show()
If this code didn't show the form(for me it didn't work) , then you must show the form modally .
-
Apr 3rd, 2003, 01:22 PM
#8
Thread Starter
Frenzied Member
If this code didn't show the form(for me it didn't work) ..
Yes you are right, that should be Showdialog. I corrected the post.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
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
|