{"id":6893,"date":"2005-11-23T14:09:00","date_gmt":"2005-11-23T14:09:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vbteam\/2005\/11\/23\/code-generation-for-overrides-in-visual-basic-net-2005\/"},"modified":"2024-07-05T14:53:13","modified_gmt":"2024-07-05T21:53:13","slug":"code-generation-for-overrides-in-visual-basic-net-2005","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/vbteam\/code-generation-for-overrides-in-visual-basic-net-2005\/","title":{"rendered":"Code Generation for Overrides in Visual Basic .Net 2005"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>by Mike Carter<\/p>\n<p>Some subtle changes were made in Visual Basic .Net 2005 to make code generation of overidden methods a little easier.&nbsp; In Visual Basic .Net 2003 and earlier, you used the code dropdowns as in Figure 1 below.<\/p>\n<p><img decoding=\"async\" src=\"\"><\/p>\n<p><b>Figure 1<\/b><\/p>\n<p>When overriding a Sub,&nbsp;a declaration stub similar to the following was generated in the editor.<\/p>\n<p><font size=\"2\"><\/p>\n<blockquote>\n<\/blockquote>\n<p><\/font><font face=\"Courier New\"><font color=\"#0000ff\" size=\"2\">Public<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Overrides<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Sub<\/font><\/font><font size=\"2\"><font face=\"Courier New\"> MyOverridableSub()<\/font><\/font><\/p>\n<p><font face=\"Courier New\"><font color=\"#0000ff\" size=\"2\">End<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Sub<\/font><\/font><\/p>\n<p>In Visual Basic .Net 2005, you never have to leave the code editor.\n<\/p>\n<p><img decoding=\"async\" src=\"\"><\/p>\n<p><b>Figure 2<\/b><\/p>\n<p>You can generate a method stub for your overridable methods by just entering &#8220;overrides &#8221; on a new line&nbsp;in the editor, as in Figure 2. An Intellisense window is displayed with a list of all overridable members&nbsp;in entire iheritance hierarchy for the inherited class.&nbsp; In this case, <font face=\"Courier New\" size=\"2\">BaseClass<\/font> which inherites from <font face=\"Courier New\" size=\"2\">System.Object<\/font>.&nbsp; Therefore,&nbsp;overridable members from <font face=\"Courier New\" size=\"2\">BaseClass<\/font> and <font face=\"Courier New\" size=\"2\">System.Object<\/font> are displayed.&nbsp; When you select a method, &nbsp;a declaration stub is generated with a call to the base method similar to the following.<\/p>\n<p><font size=\"2\"><\/p>\n<blockquote><\/blockquote>\n<p><\/font><font face=\"Courier New\"><font color=\"#0000ff\" size=\"2\">Public<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Overrides<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Sub<\/font><\/font><font size=\"2\"><font face=\"Courier New\"> MyOverridableSub()<\/font><\/p>\n<blockquote><\/blockquote>\n<p><\/font><font face=\"Courier New\" color=\"#0000ff\" size=\"2\">MyBase<\/font><font size=\"2\"><font face=\"Courier New\">.MyOverridableSub()<\/font><\/font><font face=\"Courier New\"><font color=\"#0000ff\" size=\"2\">End<\/font><font size=\"2\"> <\/font><font color=\"#0000ff\" size=\"2\">Sub<\/font><\/font><\/p>\n<p>This is just one subtle way in Visual Basic .Net 2005 in which we are trying to make your development experience a little easier.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; by Mike Carter Some subtle changes were made in Visual Basic .Net 2005 to make code generation of overidden methods a little easier.&nbsp; In Visual Basic .Net 2003 and earlier, you used the code dropdowns as in Figure 1 below. Figure 1 When overriding a Sub,&nbsp;a declaration stub similar to the following was generated [&hellip;]<\/p>\n","protected":false},"author":260,"featured_media":8818,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[192,195],"tags":[74,165],"class_list":["post-6893","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-featured","category-visual-basic","tag-ide","tag-vb2005"],"acf":[],"blog_post_summary":"<p>&nbsp; by Mike Carter Some subtle changes were made in Visual Basic .Net 2005 to make code generation of overidden methods a little easier.&nbsp; In Visual Basic .Net 2003 and earlier, you used the code dropdowns as in Figure 1 below. Figure 1 When overriding a Sub,&nbsp;a declaration stub similar to the following was generated [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/users\/260"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/comments?post=6893"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/posts\/6893\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media\/8818"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/media?parent=6893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/categories?post=6893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/vbteam\/wp-json\/wp\/v2\/tags?post=6893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}