Jerry Dausman's profileThere's an answer to you...BlogLists Tools Help

Blog


    August 16

    Try ... Catch ... When

    Here's an odd one I ran across while browsing blogs: In VB.NET the Try ... Catch syntax allows you to do a Catch 'When' some condition is met.  This is from Duncan McKenzie's Blog, but you can also check it out on the MSDN Library reference for that topic.  (You'd think an MCT like me would know all the answers ... but like I said in class ... we're all still learning!)
     
    The syntax looks like this ...
     
    Try
    [ tryStatements ]
    [ Catch [ exception [ As type ] ] [ When expression ]
       [ catchStatements ] ]
    [ Exit Try ]
    ...
    [ Finally
       [ finallyStatements ] ]
    End Try
     
    By the way ... don't try that in C# because the syntax doesn't include 'When'.