Results 1 to 8 of 8

Thread: List of what type of exceptions thrown? [Resolved]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    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.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    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.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Yes, that's what I'm doing. Do I still need the generic in that case?

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    If you are using Exception then you are using the generic since Exception is the generic type.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950
    Sorry, guess I'm not being clear.
    Say I have:
    VB Code:
    1. Try
    2. '...some code here, maybe opening a connection
    3. catch ex as oledbexception
    4. '...handling code
    5. catch ex as invalidoperationexception
    6. '...handling code
    7. 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.

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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
  •  



Click Here to Expand Forum to Full Width