Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VB equivalent to FoxPro's PROGRAM()?
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00421703
Message ID:
00422124
Vues:
28
>>>>>>>>>>>>>>>...
>on error MailMSAskingForGlobalErrorHandling
>>>>>>>>>>>>>>>>>
>
>Funny funny funny!
>
>I wonder how this new Catch Try Fail stuff is going to work... I have yet to hear if will be able to be assigned globallly, and if it can't, urrrghhhh (grunting noises and gritting teeth).

The "Try ... Catch ... Finally" is more local than the "on error" is today!

See this example:
The next version of Visual Basic is slated to offer centralized error handling. Visual Basic will support a try…catch…finally construct, just like those "respectable" languages. You’ll be able to put a subroutine at the top of your code and let the errors bubble up into it. Here’s an example of how structured error handling will be implemented: 
Sub SafeWrite()
Try
  Open "Testfile"
•••
  Write #1
Catch
   Kill "Testfile"
Finally
   Close #1
End Try
End Sub
This is an extract of: http://msdn.microsoft.com/msdnmag/issues/0400/vbnexgen/vbnexgen.asp

Notice that Java and C++ already use this syntax for error handling.
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform