OdeToCode IC Logo

VB.NET versus C# Web Forms

Sunday, July 17, 2005

There is a subtle difference in the default ASP.NET 2.0 ASPX files for VB and C#. I mention the difference only because C# is traditionally the ‘explicit’ language while VB.NET is the language with late binding features built-in.

A new VB.NET web form places AutoEventWireup=”false” in it’s @ Page directive. This means your code is responsible for explicitly wiring up Page events.

A new C# web form places AutoEventWireup=”true” in it’s @Page directive. This means the runtime will reflect upon your code to find method names in the form of Page_EventName and attach the methods as event handlers for named event.

Why is this?

VB.NET’s Handles keyword allows you to catch an event in a declarative manner. There is no comparable feature in C#. It’s a nice feature to have.

GWBasic Man Monday, July 25, 2005
I have also found that VB7 Supports (C# does not): WithEvents, The With Clause, Ability to name Interface Implements any thing your want, Allows a Property that takes a Parameter, Can perform Late binding, Allows Declarations of non public enums inside an Interface... plus a few more like Select Case's superiority to C#'s switch.
Comments are closed.