{"id":968,"date":"2009-04-11T02:18:08","date_gmt":"2009-04-10T17:18:08","guid":{"rendered":"http:\/\/gigasmegas.com\/?p=968"},"modified":"2009-04-15T04:38:18","modified_gmt":"2009-04-14T19:38:18","slug":"visual-basic-2008-tips-trycatchfinally%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc%e5%88%b6%e5%be%a1","status":"publish","type":"post","link":"http:\/\/gigasmegas.com\/?p=968","title":{"rendered":"VB.NET Tips Try&#8230;Catch&#8230;Finally\u3067\u30a8\u30e9\u30fc\u5236\u5fa1"},"content":{"rendered":"<p><a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/rokuz.com\/?p=968');\"  href=\"http:\/\/rokuz.com\/?p=968\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rokuz.com\/wp-content\/uploads\/2009\/04\/snag-0116-400x222.png\" alt=\"Try...Catch...Finally \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u30a8\u30e9\u30fc\u51e6\u7406\" title=\"Try...Catch...Finally \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u30a8\u30e9\u30fc\u51e6\u7406\" width=\"400\" height=\"222\" class=\"alignnone size-medium wp-image-979\" srcset=\"http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/04\/snag-0116-400x222.png 400w, http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/04\/snag-0116.png 499w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<address>photo by <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/www.flickr.com\/photos\/discoweasel\/');\"  href=\"http:\/\/www.flickr.com\/photos\/discoweasel\/\">DiscoWeasel<\/a><\/address>\n<p>\u30bd\u30d5\u30c8\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u907f\u3051\u3066\u901a\u308c\u306a\u3044\u306e\u304c\u30a8\u30e9\u30fc\u5236\u5fa1\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u306a\u3093\u3068\u3057\u3066\u3067\u3082\u3001\u5f37\u5236\u7d42\u4e86\u300c\u30d6\u30c1\u30c3\u300d\u2026\u2026\u306f\u3001\u907f\u3051\u305f\u3044\u6240\u3067\u3059\u3002<\/p>\n<p>\u5f37\u5236\u7d42\u4e86\u3059\u308b\u306b\u3057\u3066\u3082\u3001\u306a\u306b\u304b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u63d0\u793a\u3057\u3066\u7d42\u4e86\u3055\u305b\u305f\u3044\u3002<\/p>\n<p>VB.NET(.NET Framework)\u304b\u3089\u5c0e\u5165\u3055\u308c\u305f<br \/>\nTry&#8230;Catch&#8230;Finally\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u3059\u304c\u3001VB6.0\u307e\u3067\u306e\u30a8\u30e9\u30fc\u51e6\u7406\u306e\u3001On Error Goto\u3068\u306f\u3001\u304b\u306a\u308a\u9055\u3044\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h4>\u6982\u5ff5\u306e\u9055\u3044<\/h4>\n<p>VB.NET<\/p>\n<dt>Try&#8230;Catch&#8230;Finally<\/dt>\n<dd>\u69cb\u9020\u5316\u4f8b\u5916\u51e6\u7406<\/dd>\n<p>VB6.0<\/p>\n<dt>On Error Goto<\/dt>\n<dd>\u975e\u69cb\u9020\u5316\u4f8b\u5916\u51e6\u7406<\/dd>\n<p>\u3053\u306e\u3001\u547c\u3073\u65b9\u304c\u3059\u3079\u3066\u3092\u7269\u8a9e\u3063\u3066\u3044\u308b\u3088\u3046\u306b\u601d\u3048\u307e\u3059\u3002<\/p>\n<p>\u3068\u2026\u3001\u65b9\u5411\u6027\u304c\u9055\u3046\u3001\u9055\u3046\u3001VB6.0\u3068\u306e\u6bd4\u8f03\u3067\u306f\u306a\u304f\u3001VB.NET(.NET Framework)\u306b\u304a\u3051\u308bTry&#8230;Catch&#8230;Finally\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f7f\u7528\u65b9\u6cd5\u3092\u30a8\u30f3\u30c8\u30ea\u30fc\u3057\u307e\u3059\u3002<\/p>\n<h4>\u5fc5\u9808\u6587<\/h4>\n<dl>\n<dt>Try<\/dt>\n<dd>\u5148\u982d\u6587\u3002\u5fc5\u9808\u3067\u3059\u3002Try\u30d6\u30ed\u30c3\u30af\u3053\u308c\u304c\u306a\u304f\u3066\u306f\u3001\u59cb\u307e\u308a\u307e\u305b\u3093\u3002<\/dd>\n<dt>End Try<\/dt>\n<dd>\u7d42\u7aef\u6587\u3002\u5fc5\u9808\u3067\u3059\u3002Try&#8230;Catch&#8230;Finally \u69cb\u9020\u306e\u7d42\u308f\u308a\u3092\u8868\u3057\u307e\u3059\u3002<\/dd>\n<p>\u5fc5\u305a\u3001\u4f7f\u7528\u3059\u308b\u306e\u306f\u3001\u3053\u306e\uff12\u3064\u3001\u201dTry \uff5e End Try\u201d\u3002<\/p>\n<p>\u5f8c\u306f\u3001\u4f7f\u7528\u7528\u9014\u306b\u5fdc\u3058\u3066\u3001\u4f7f\u3044\u5206\u3051\u3066\u3044\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u3001\u201dIf \uff5e End If\u201d\u3001\u201dSub \uff5e End Sub\u201d \u3068\u540c\u3058\u3067\u3001\u59cb\u307e\u308a\u3068\u7d42\u308f\u308a\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002\n<\/dl>\n<h4>\u30aa\u30d7\u30b7\u30e7\u30f3<\/h4>\n<p>\u7701\u7565\u53ef\u80fd\u306a\u30aa\u30d7\u30b7\u30e7\u30f3\u30d6\u30ed\u30c3\u30af\u3068\u3057\u3066\u6b21\u304e\u306e\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\nCatch\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306f\u8907\u6570\u306eIf\u6587\u304c\u3042\u3063\u3066\u3001else\u6587\u304c\u5358\u72ec\u3067\u3042\u308b\u3063\u3066\u611f\u3058\u304b\u306a<br \/>\n\u3002<\/p>\n<dl>\n<dt>Catch\u30d6\u30ed\u30c3\u30af<\/dt>\n<dd>\n\u8907\u6570\u306e Catch \u30d6\u30ed\u30c3\u30af\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<br \/>\nTry \u30d6\u30ed\u30c3\u30af\u306e\u51e6\u7406\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3068\u3001Catch \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306b\u51e6\u7406\u304c\u79fb\u308a\u3001\u305d\u306e\u30a8\u30e9\u30fc\u3092Catch\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3067\u51e6\u7406\u3067\u304d\u308b\u304b\u5224\u5b9a\u3055\u308c\u307e\u3059\u3002\n<\/dd>\n<p>Try \uff5e Catch \u306e\u9593\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3001\u51e6\u7406\u304cCatch\u306b\u79fb\u308a\u307e\u3059\u3002<\/p>\n<p>Catch\u306b\u306f\u3001exception \uff08\u4efb\u610f\u306e\u5909\u6570\uff09\u3068\u3001type(\u30af\u30e9\u30b9\u30d5\u30a3\u30eb\u30bf\u306e\u7a2e\u985e)\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u3002exception\u3092\u6307\u5b9a\u3059\u308b\u304b\u3001\u3057\u306a\u3044\u304b\u3067\u51e6\u7406\u304c\u5909\u308f\u3063\u3066\u304d\u307e\u3059\u3002<\/p>\n<dt>Catch\u306e\u307f\uff08exception\uff08\u30a8\u30e9\u30fc\u5024\uff09\u6307\u5b9a\u306a\u3057\u3002\uff09<\/dt>\n<dd>\n\u30a8\u30e9\u30fc\u5024\u3092\u5224\u5b9a\u3057\u306a\u3044\u306e\u3060\u304b\u3089\u3001\u5f53\u7136\u3001\u3059\u3079\u3066\u306e\u30a8\u30e9\u30fc\u51e6\u7406\u306f\u3053\u3053\u3067\u51e6\u7406\u3055\u308c\u307e\u3059\u3002\n<\/dd>\n<dt>exception\u4f7f\u7528<\/dt>\n<dd>exception\uff08\u4efb\u610f\u306e\u5909\u6570\uff09\u306b\u30a8\u30e9\u30fc\u306e\u5024\u304c\u5165\u308a\u307e\u3059\u3002<br \/>\n\u3053\u306e\u30a8\u30e9\u30fc\u306e\u5024\u304c<\/p>\n<p>type(\u30af\u30e9\u30b9\u30d5\u30a3\u30eb\u30bf\u306e\u7a2e\u985e)\u3068\u540c\u3058\u306a\u306e\u304b\u3069\u3046\u304b\u5224\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>exception\uff08\u30a8\u30e9\u30fc\u5024\uff09\u3068<strong>\u540c\u3058<\/strong>\u30a8\u30e9\u30fc\u306e\u5834\u5408\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u3092<strong>\u884c\u3044\u307e\u3059<\/strong>\u3002<\/li>\n<li>exception\uff08\u30a8\u30e9\u30fc\u5024\uff09\u3068<strong>\u9055\u3046<\/strong>\u30a8\u30e9\u30fc\u306e\u5834\u5408\u3001\u30a8\u30e9\u30fc\u51e6\u7406\u306f<strong>\u884c\u308f\u305a\u3001\u3053\u306eCatch\u6587\u304b\u3089\u306f\u51e6\u7406\u3092\u629c\u3051\u307e\u3059\u3002<\/strong><\/li>\n<\/ul>\n<\/dd>\n<\/dl>\n<p>When\u30d6\u30ed\u30c3\u30af\u306f\u3001\u79c1\u7684\u306b\u306f\u3042\u307e\u308a\u4f7f\u7528\u3057\u305f\u3053\u3068\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3002<\/p>\n<dl>\n<dt>When\u30d6\u30ed\u30c3\u30af<\/dt>\n<dd>\nCatch\u30d6\u30ed\u30c3\u30af\u306b\u5236\u5fa1\u304c\u3046\u3064\u308a\u3001exception\uff08\u30a8\u30e9\u30fc\u5024\uff09\u3068\u540c\u3058\u30a8\u30e9\u30fc\u3060\u3063\u305f\u5834\u5408\u3001\u3055\u3089\u306b\u3001\u7d5e\u308a\u8fbc\u3080\u3068\u3044\u3063\u305f\u611f\u3058\u3067\u3059\u3002<\/dd>\n<\/dl>\n<p>Finally\u30d6\u30ed\u30c3\u30af\u3067\u3001\u30a8\u30e9\u30fc\u767a\u751f\u6642\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u30af\u30ed\u30fc\u30ba\u3057\u305f\u3044\u3001\u30e1\u30e2\u30ea\u3092\u89e3\u653e\u3057\u305f\u3044\u306a\u3069\u306e\u51e6\u7406\u304c\u884c\u3048\u307e\u3059\u3002<\/p>\n<dl>\n<dt>Finally\u30d6\u30ed\u30c3\u30af<\/dt>\n<dd>\nTry \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u304b\u3089\u629c\u3051\u308b\u3068\u304d\u3001\u5fc5\u305a Finally \u30d6\u30ed\u30c3\u30af\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\n<\/dd>\n<\/dl>\n<p>Exit Try \u306f\u3001For\u69cb\u6587\u306e\u201dExit For\u201d  Sub\u69cb\u6587\u306e\u201dExit Sub\u201d \u306a\u3069\u3068\u540c\u3058\u611f\u3058\u3067\u3001\u51e6\u7406\u3092\u9014\u4e2d\u3067\u629c\u3051\u3055\u305b\u308b\u5f79\u76ee\u3092\u3082\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<dl>\n<dt>Exit Try<\/dt>\n<dd>\nTry&#8230;Catch&#8230;Finally \u69cb\u9020\u304b\u3089\u629c\u3051\u307e\u3059\u3002<br \/>\n\u305d\u3057\u3066\u3001End Try \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u6b21\u306e\u30b3\u30fc\u30c9\u306b\u5236\u5fa1\u304c\u79fb\u308a\u307e\u3059\u3002<br \/>\n\u6ce8\u610f\uff1aFinally \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306f\u5fc5\u305a\u5b9f\u884c\u3055\u308c\u307e\u3059\u304c\u3001Finally \u30d6\u30ed\u30c3\u30af\u5185\u306b\u306f\u8a18\u8ff0\u3067\u304d\u307e\u305b\u3093\u3002\n<\/dd>\n<\/dl>\n<h4>\u7279\u6027\u3001\u6ce8\u610f\u70b9<\/h4>\n<dt>\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7<\/dt>\n<dd>\nTry\u30d6\u30ed\u30c3\u30af\u3068\u3001Catch\u30d6\u30ed\u30c3\u30af\u306f\u5225\u3005\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3068\u3057\u3066\u6271\u308f\u308c\u308b\u306e\u3067\u3001Try\u30d6\u30ed\u30c3\u30af\u5185\u3067\u5ba3\u8a00\u3055\u308c\u305f\u5909\u6570\u3092Catch\u30d6\u30ed\u30c3\u30af\u5185\u3067\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u306a\u3044\u3002<br \/>\n\u4e21\u65b9\u306e\u30d6\u30ed\u30c3\u30af\u3067\u3001\u4f7f\u7528\u3057\u305f\u3044\u3068\u304d\u306f\u3001Try&#8230;Catch&#8230;Finally \u306e\u5916\u3067\u5ba3\u8a00\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\n<\/dd>\n<dt>Catch\u30d6\u30ed\u30c3\u30af\u304cTry \uff5e End Try\u5185\u306b\u4e00\u3064\u3082\u306a\u3044\u3068\u304d<\/dt>\n<dd>\nFinally\u30d6\u30ed\u30c3\u30af\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u3068\u304d\u3060\u3051\u3001Finally\u30d6\u30ed\u30c3\u30af\u304c\u5fc5\u9808\u3068\u306a\u308a\u307e\u3059\u3002\n<\/dd>\n<h4>exception\u306b\u3064\u3044\u3066<\/h4>\n<p>Catch\u30d6\u30ed\u30c3\u30af\u3067\u3001\u30a8\u30e9\u30fc\u5024\u3068\u3057\u3066\u7528\u3044\u3089\u308c\u308bexception\u5024\u3067\u3059\u304c\u3001\u3053\u306e\u30a8\u30e9\u30fc\u5024\u306f\u3001Exception \u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3001Exception \u30af\u30e9\u30b9\u304b\u3089\u6d3e\u751f\u3057\u305f\u30af\u30e9\u30b9\u3067\u3059\u3002<\/p>\n<p>\u3053\u306eException\u30af\u30e9\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u306f\u3001\u30a8\u30e9\u30fc\u756a\u53f7\u3084\u30e1\u30c3\u30bb\u30fc\u30b8\u306a\u3069\u306e\u30a8\u30e9\u30fc\u60c5\u5831\u304c\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>photo by DiscoWeasel \u30bd\u30d5\u30c8\u958b\u767a\u306b\u304a\u3044\u3066\u3001\u907f\u3051\u3066\u901a\u308c\u306a\u3044\u306e\u304c\u30a8\u30e9\u30fc\u5236\u5fa1\u3067\u3057\u3087\u3046\u3002 \u306a\u3093\u3068\u3057\u3066\u3067\u3082\u3001\u5f37\u5236\u7d42\u4e86\u300c\u30d6\u30c1\u30c3\u300d\u2026\u2026\u306f\u3001\u907f\u3051\u305f\u3044\u6240\u3067\u3059\u3002 \u5f37\u5236\u7d42\u4e86\u3059\u308b\u306b\u3057\u3066\u3082\u3001\u306a\u306b\u304b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u63d0\u793a\u3057\u3066\u7d42\u4e86\u3055\u305b\u305f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[303,25],"tags":[306,272,308,331,333,332,254,330,304,307,100],"class_list":["post-968","post","type-post","status-publish","format-standard","hentry","category-vbnet","category-computer","tag-net","tag-272","tag-basic","tag-catch","tag-error","tag-finally","tag-tips","tag-try","tag-vb","tag-visual","tag-100"],"_links":{"self":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=968"}],"version-history":[{"count":17,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/968\/revisions"}],"predecessor-version":[{"id":1008,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/968\/revisions\/1008"}],"wp:attachment":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}