{"id":36,"date":"2008-09-23T14:48:39","date_gmt":"2008-09-23T21:48:39","guid":{"rendered":"http:\/\/blog.rlisolutions.com\/code\/36\/are-you-running-in-the-ide\/"},"modified":"2008-09-23T14:48:39","modified_gmt":"2008-09-23T21:48:39","slug":"are-you-running-in-the-ide","status":"publish","type":"post","link":"http:\/\/ericburdo.com\/blog\/code\/36\/are-you-running-in-the-ide\/","title":{"rendered":"Are you running in the IDE?"},"content":{"rendered":"<p>Two methods, one for .NET (Visual Basic, but easily adjusted for C#) and the other for VB Classic (VB 5 and 6)<\/p>\n<p>To check and see if the .NET code is running from the IDE: <\/p>\n<p><em>More specifically, the .NET method checks to see if there is a debugger attached.&#160; It is possible to attach a debugger to a compiled exe, so this would return True.<\/em><\/p>\n<blockquote>\n<p>&lt;code&gt;      <br \/>&#160; If System.Diagnostics.Debugger.IsAttached Then       <br \/>&#160;&#160;&#160; &#8216;This is a way to see if we are running in the IDE.&#160; <\/p>\n<p>&#160; End If      <br \/>&lt;\/code&gt; <\/p>\n<\/blockquote>\n<p>And, if you&#8217;re using VB Classic, you can use this: <\/p>\n<blockquote>\n<p>&lt;code&gt;      <br \/>&#8216;Since Debug commands are compiled OUT, this will never return an error       <br \/>&#8216;when the code is compiled.       <br \/>Private Function IsDebugMode as Boolean       <br \/>&#160; On Error Resume Next       <br \/>&#160; Debug.Assert 1\/0       <br \/>&#160; IsDebugMode = (Err.Number &lt;&gt; 0)       <br \/>&#160; On Error Goto 0       <br \/>End Function       <br \/>&lt;\/code&gt;<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Two methods, one for .NET (Visual Basic, but easily adjusted for C#) and the other for VB Classic (VB 5 and 6) To check and see if the .NET code is running from the IDE: More specifically, the .NET method checks to see if there is a debugger attached.&#160; It is possible to attach a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-36","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/posts\/36","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/comments?post=36"}],"version-history":[{"count":0,"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/posts\/36\/revisions"}],"wp:attachment":[{"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/media?parent=36"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/categories?post=36"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ericburdo.com\/blog\/wp-json\/wp\/v2\/tags?post=36"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}