Even though I used previous versions of Visual Basic (and VBScript) for a short time before beginning .NET development, I consider myself a C# coder. Not only was C# the language I used to learn .NET, it is only the one that I like better. I learned it faster, it was easier for me to read, and it was just a more natural fit for me. A mentor of mine calls it "The Programming Language of the Gods". Don't know if I'd go that far, but it has served me well.

However, because the current project I'm working on, I have been forced to the dark side of VB.NET. So far it's been fine; but every once in a while I run into a snafu with the syntax. Like yesterday, I wanted to create an event to be shared among several controls in a WinForm. In VB.NET, you have to specify a Handles clause that assigns it to a particular control/event. My fellow consultant was able to let me know that I can specify multiple control/events in the Handles clause by separating them with a comma. That solved the problem solved!.

If you ever find yourself in this situation, check out this post by Kathleen Dollard called What a C# Coder Should Know Before They Write VB; and make sure you read it sooner than later to save yourself some aggravation.

UPDATE (7/25/2008) - Due to its great popularity and all of the feedback on this post, Kathleen has written a second edition of this post. It has 10 more things to look out for, and has several clarifications.

July 24, 2008 13:41 by RafaelV
E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed