Long Live VB!!! or not?

Ok, first a disclaimer: I’m a Microsoft MVP with a competency in Visual Basic.

Normally I would not give this much thought, I’ve always favored VB (I started using it back when it was in version 3) over all other languages and thought very little of the debates that went on online comparing it to other languages.

Even when I read columns like this one, I felt nothing of it. ‘VB will prevail’ I used to tell myself, after all, no sane company in its right mind would alienate its ‘largest group of developers’. I still think so.

However, when I am asked to ‘consider’ switching over to C# by my company, and specifically my boss and friend, who he himself is a former VB MVP, a few different thought-storms are brewing in my mind.

But probably the most important question is: how did this happen?

That is when I decided to write this blog. The fact of the matter is, there are many reasons for this to happen. The migration of developers from other platforms, J2EE for example, find a more familiar face in C#. VB6ers NOT migrating to the .Net world is another factor. And perhaps, the mere fact that VB is dumbed the hobbyists language of choice (after all, it is the most downloaded setup of Microsoft’s ‘express’ editions) is yet another reason why ‘professionals’ are migrating.

But perhaps most importantly is universities worldwide offering C# as the development language of choice (or any semicolon language for that matter).

All the rest, is merely the chain reaction set in motion. C# books becoming more popular and better selling. C# developers becoming more desirable and thus paid better. Resources for C# are becoming much more available than for VB. And now Microsoft, the company that popularized the language, are treating it as a second-class citizen.

I don’t mind becoming ‘multilingual’, but I’ve grown to love and respect VB throughout the years, and I won’t go down without a fight! In my opinion, VB is and will remain the ‘easiest’ most efficient language to develop applications in; plus I don’t think it is fair. Bill Gates: help!!

Anyway I’ll take C#, with a grain of salt.

What do you think?

Links:

Visual Basic Power Packs 2.0

Line and Shape controls, PrintForm component, and Printer Compatibility LibraryMicrosoft Visual Basic 2005 Power Packs 2.0 includes a new set of Line and Shape controls and updated versions of the two previously released Visual Basic 2005 Power Packs, the PrintForm Component and the Printer Compatibility Library. All three are now included in a single assembly making them even easier to use and redistribute with your application.

Links:
http://msdn2.microsoft.com/en-us/vbasic/bb735936.aspx

Partnership: Microsoft & Facebook

Hey, all you Facebook fans out there, Microsoft and Facebook have launched a partnership and Microsoft has released a ‘Facebook Developer Toolkit’ which allows you to create applications for Facebook using Microsoft Popfly and Visual Studio Express.

You can even create a Windows Forms application that connects to Facebook using Facebook’s API!! Now that I like!

Enjoy!!

Links:
http://msdn2.microsoft.com/en-us/express/bb510381.aspx

Microsoft releases: VS2008 Beta 2, .Net Framework 3.5 Beta 2 and SilverLight 1.0 RC

New releases from Microsoft for all you developers out there:

Happy downloading!

Links:
http://msdn2.microsoft.com/en-us/vstudio/default.aspx
http://www.microsoft.com/silverlight/install.aspx

Quickie: MSDN Nuggets

‘Don’t have the time to read a 10-page how-to article or watch a full length webcast? Try an MSDN Nugget, a webcast that takes you step-by-step to discovering new functionality or exploring a hot developer topic, all in 10-15 minutes. View them online now or download for later reference.’

Links
http://www.microsoft.com/uk/msdn/nuggets/

Live.com: Search Dot Net

I just came back from Friday prayer, my kids are out with their Aunt (probably at McDonald’s), my wife’s in the kitchen prepping something up for lunch, so I have the study room all to myself. I went in, and instead of firing up my laptop, I logged on to my desktop, which I don’t usually log on to because my kids have it monopolized.

I fired up IE7 and was about to go check how Spider-man 3 did in the box office, when I was sort of taken aback by the home page; www.live.com. Its been a while since I’d done any searching on Live (yes, I confess, I usually search on Google; I’m sorry :-)). So, for the sake of humanity, I decided to go ahead and give it a try.

Being a self-centered geek, and an MVP, I decided to search for ‘Bashar Lulu’, and boy was I amazed by the results. Not by the number of hits, as many as they were, but by the organization, the relevance, the readability and the fact that I could actually use this as a reference. These are things I could never have done a while ago, because I saw Live as lacking, frail and simply un-usable. The results where out of order (by relevance, or importance), the engine itself seemed buggy; not any more.

Mind you, I’m not saying that Live is perfect, or that it is better than Google, I’m just saying that its getting better, much better.

Now, let me continue my story. One of the search results took me here; a list of Visual Basic MVP blogs. Yes, my name was there, and a few names down, was Dan Appleman’s. I’ve always been a fan of Dan’s, back from the days of VB5 and his book on the Windows API. Under his name was a link to his blog which I immediately clicked on.

To cut a long story short, it was on Dan’s blog that I learned about SearhDotNet a search site for .Net developers. Based on Google’s custom search facility (which allows you to create your own search engine), SearchDotNet gives .Net developers information relevant to .Net only.

Dan puts it as: ‘Many typical developer search terms (like “cryptography” or “Url”) apply to many technologies, not just .NET. When I search for cryptography, I don’t want to know how to do it in PHP, nor am I interested in the latest government policies on the topic. I want to know how it works in .NET.’

Not only that, but Dan also allows users to suggest ‘inclusion criteria‘ where we can suggest what sites to add to the search results.

My kids are back, they want the PC, got to go!

Links:
http://www.live.com
http://msdn2.microsoft.com/en-us/vbasic/ms789067.aspx
http://www.danappleman.com/
http://www.google.com/coop/cse/overview
http://searchdotnet.com/about.aspx#choose

Visual Basic Power Packs

Ever since it introduced Visual Basic .Net some six years ago, Microsoft has been striving to have developers jump the VB6 wagon and onto the .Net one. Being a VB6er myself I can sympathize with all those who still find it difficult to do so.

Migrating VB6 code to VB .Net is at best, a helluva task. Especially if you were like me, everything in one EXE file. No DLLs, no business logic and no stored procedures. In other words no logical architecture of any kind. All SQL statements where adhoc (inline SQL statements) which means amongst other things poor performance and almost no security whatsoever.

I started with VB3 as an amateur and things kinda evolved from there. Proper solution design was not something to look for in an application. Does it work? Does it do the job? Performance and security came in at a distant second.

The truth of the matter lies in realizing that VB .Net is NOT the same language as VB6. It looks the same, tastes the same but isn’t the same at all. In my opinion it is, almost always, best to rewrite the entire application. But that is not always feasible. Some of these applications have been years in the making, with literally thousands and thousands of man hours in the making.

Microsoft realizes that and have therefore introduced the ‘Visual Basic Power Packs’, later herein VBPP. Officially ‘Power Packs are free Add-Ins, Controls, Components, and Tools for you to use with Visual Basic 2005 to make developing great applications even easier.’ In simple English, they’re new tools to ease the transition from VB6 to .Net. To sort of, phase in the transition. To create a familiar environment for VB6ers, one that was alienated by Visual Studio 2002 and 2003.

VBPP includes the ‘Microsoft Interop Forms Toolkit’ which allows you to open .Net forms in VB6 applications, thus ‘instead of upgrading the entire code base, (VB6) applications can now be extended one form at a time’. VBPP also includes the ‘Microsoft Printer Compatibility Library’ which ‘allows projects that used the Printer and Printers Collection in Visual Basic 6.0 to be upgraded without having to re-write your printing logic’.

Now, Microsoft will also bring the ‘Data Repeater Control’ to VBPP which ‘is similar to DataRepeater control found in Visual Basic 6.0 but it’s even simpler to use because you do not need create a UserControl first. All you do is simply drag and drop your dataset to the Repeater control and the designer will generate the controls for you’.

And ‘Line and Shape Controls’ with which you can ‘add graphics to your Windows Form at design time just like you did in Visual Basic 6.0’. You can vote on which of these you’d like to see first.

Find out more about Visual Basic Power Packs here http://msdn2.microsoft.com/en-us/vbasic/aa701257.aspx.

Enjoy!

Take Control of Your System

First a personal piece of information: my MVP status has been renewed! Wooohooo! I’m happy 🙂

Now for the real stuff; the other day I was trying to uninstall WDS (Windows Desktop Search) and since I did not find the uninstaller in ‘Add or Remove Programs’ I had to do it manually. I found an entry on the net that explains in detail how to remove WDS and it involved removing the installation folder in the ‘Program Files’ directory.

When I tried to delete the folder, I could not because it was ‘locked’. A quick search online turned up this utility that enables you to unlock ANY folder and subsequently delete it. Lovely tool indeed. It will also give you of all locking threads and you can decide which to kill / remove.

On other news, remember a company called Sysinternals? Well, Microsoft acquired the company back in 2006. (You will be redirected to a Microsoft Technet site.) Sysinternals had some extremely wonderful tools that enabled you to monitor literally everything on your computer. You can monitor the entries to your registry (RegMon) in real time! You can monitor your hard disk activity (FileMon). You can monitor the processes running on you computer (Process Explorer); it even shows .Net assemblies and other JIT (just in time) information.

The one I liked most, was Autoruns which allows you to view and switch on or off all the applications that start with Windows. Please note that RegMon and FileMon have been replaced by Process Explorer which, apparently, will do the same job.

Check it out!!

Links:
http://ccollomb.free.fr/unlocker
http://www.sysinternals.com
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Regmon.mspx
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Filemon.mspx
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/Autoruns.mspx

Hold on sugar!

Mahed Chand blogged about why he thinks developers should choose C# over VB.Net here. I commented on his blog and am hereby repeating my response here.

I’ll cut to the chase. I strongly disagree. I have nothing against C# but VB is still the language of choice.

Here is what I think;

  1. If you are migrating from VB, then migrate to VB.Net. You’re still gonna have to learn a lot, but the syntax is still 70% the same. Unlike C# where the syntax is 90% different.
  2. The VB developer environment is at least twice as productive as that of C#. A bit more verbose, but still more productive.
  3. Compiled VB code is smaller than that of C# (even though by a very small margin).
  4. Where I live, VB developers average salary is MUCH higher than that of the C# counterpart.
  5. Both VB and C# can do 99% of what the other can do.
  6. In Orcas (the new Visual Studio from Microsoft, set to be released later this year) VB.Net supports a wider range of Lambda expressions.
  7. More people have downloaded the Express edition of VB than C# (Source: Microsoft at MVP Global Summit).
  8. Your sister site is VB .Net Heaven 🙂

Enjoy!

Links
http://www.c-sharpcorner.com/Blogs/BlogDetail.aspx?BlogId=151

My.Settings

Back in the VB6 days, when creating applications that required specific settings unique to a particular machine (such as screen sizes, fonts or even connection strings), I used to use either an INI file or the registry for storing these settings.

A few days ago, when writing an application on .Net v2, I needed to store similar settings and it had me thinking; should I use an INI file, the registry or even an XML file. The logical answer seemed to be to use an XML. So, I started searching the internet for possible solutions.

For the better part of half-an-hour I went through a number of articles, knowledge bases, forums and blogs and then it struck me. A pure and simple answer on the Microsoft MSDN forums (http://forums.microsoft.com/msdn). Why not use My.Settings?

When using My.Settings, you are actually saving the settings in the app.config file in XML format. Simply double click on ‘My Project’, select the ‘Settings’ tab and enter the settings you require for your application. Remember these settings are unique for the local machine and shall NOT be available on any other machine.

Now, when adding new settings, you need to add a name for the setting, which cannot include spaces. You need to select the type, which is the data type. You also need to specify the scope. For this you have 2 settings, either ‘User’ which means that this setting is a ‘read-write’ setting, or ‘Application’ which simply means that this is a ‘read-only’ setting. You also need to specify a value.

Now, in code, whenever you need to read a particular setting then simply use My.Settings to access the setting value. You can also save a new value to pre-defined setting. Lost? Well, so was I at the beginning; so lets show an example. Lets assume we have 2 settings, named ‘Username’ and ‘Password’ (you would NOT usually save the username and password in a settings file; this is only for demonstrational purposes). Lets also assume that we have a textbox called ‘tbUsername’ and another called ‘tbPassword’.

In code, to read the settings into the textboxes you would simply write:

tbUsername.Text = My.Settings.Username
tbPassword.Text = My.Settings.Password

Now, assuming the user changes these and you’d like to store the new values, you’d write:

My.Settings.Username = tbUsername.Text
My.Settings.Password = tbPassword.Text

and then you’d type:

My.Settings.Save()

Read more here and here

Enjoy!

Links
http://msdn2.microsoft.com/en-us/library/saa62613(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/ms379611(vs.80).aspx