|
-
Dec 18th, 2003, 11:43 AM
#1
Thread Starter
Frenzied Member
List of what type of exceptions thrown? [Resolved]
Another general question. Is there a list of what type of exceptions can be thrown by controls, or do you have to look up individual methods? I.e., a list of all exceptions that can be thrown by combobox methods, another for ado connection objects, etc?
Last edited by salvelinus; Dec 18th, 2003 at 02:07 PM.
-
Dec 18th, 2003, 11:58 AM
#2
I don't believe there is a list but all Exceptions should inherit from the Exception object. The closest thing is to do a search in the ObjectBrowser. Pull up the ObjectBrowser from the View menu and click the search icon (it has a pair of binoculars on it). Then search for 'Exception' with the 'Match Substring' option and in 'Selected Components'. That should give you most exception types.
-
Dec 18th, 2003, 12:06 PM
#3
Thread Starter
Frenzied Member
Thanks again. If I catch all the listed exceptions, do I still need a generic catch statement?
Last edited by salvelinus; Dec 18th, 2003 at 12:27 PM.
-
Dec 18th, 2003, 12:32 PM
#4
If you catch Exception then it will catch all since they all derive from Exception. You really only need to list other types if you want to handle them differently.
-
Dec 18th, 2003, 01:00 PM
#5
Thread Starter
Frenzied Member
Yes, that's what I'm doing. Do I still need the generic in that case?
-
Dec 18th, 2003, 01:08 PM
#6
If you are using Exception then you are using the generic since Exception is the generic type.
-
Dec 18th, 2003, 01:35 PM
#7
Thread Starter
Frenzied Member
Sorry, guess I'm not being clear.
Say I have:
VB Code:
Try
'...some code here, maybe opening a connection
catch ex as oledbexception
'...handling code
catch ex as invalidoperationexception
'...handling code
end try
and those are the only two exceptions listed in help for opening the connection, do I still need
catch ex as exception
after the first two.
-
Dec 18th, 2003, 01:50 PM
#8
Its not a must but it is always good to have a catch all.
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
|