I was forced to spend some time with VB.NET in Visual Studio today, and all I can say is that the experience was frustrating to no end. My project had to do with some Web Browser interop and so I had imported the rather huge mshtml library. This absolutely killed the VB editor. Anytime Intellisense needed to look up a class name, the whole IDE froze for about 10 seconds. And I’m not exaggerating!!!

 

While debugging I couldn’t edit code – hmmm… interesting concept – Edit and Continue is there, but well, I can’t edit the code actually. WTF? There’s an option in the Configuration options but it was set Allow editing code while debugging. Go figure. BTW, I’ve seen the same behavior with Edit and Continue in VS2005 with C#. Once enabled, I can no longer edit source code. This makes no sense. What am I missing here?

 

Who was the genius that came up with the concept of sticking the Event hookup options into the Editor page in VB instead of on the property editor, where it makes most sense? Ok, maybe I’m partial, but it seems everything else about a class is visible in the property editor, shouldn’t the event hookups be there too? Nope, they’re in the editor and you have to dig through all the controls to find the right one, find the event to connect to. Talk about unintuitive UI design…

 

Next, I was working with delegates and dynamically hooking up delegates to the MSHTML document object. It works flawlessly in C#, but in VB the code would simply not work. The delegates were hooked up to the document events but the events refused to fire. And the whole delegate syntax – man what a mess.

 

Somehow it looks like VB is calling event delegates differently than C#. The code uses a DispId attribute and to handle the event invocation fired from the HTML document, but for some reason the VB code would not fire the event which attached to a generic object not an explicit event.


This project needed to interface with a VB application hence the need to do things with VB, but after 45 minutes of trying to struggling with this stuff, I created a small wrapper C# DLL that manages the event hookups and 5 minutes later everything was running fine. Thank god for interoperability in VS.NET, but this was a very frustrating experience.