Do You Code in Visual Basic?

"Visual Basic" graphic from the old packagin In my capacity as a developer evangelist for Microsoft, I’ve posted mostly C# code. I find that languages like Python and Ruby are very good not just as languages for production code, but also as great prototyping or “sketching out an idea” languages, and since Microsoft makes IronPython and IronRuby, it makes sense for me to post code in those languages here as well. Steve Yegge may have been exaggerating for effect when he wrote that JavaScript is the most important programming language in the world, but it’s still quite important to know, and I’m sure that I’ll post in it sometime soon. Visual Studio 2010 puts F# front-and-center, alongside the other programming languages, and you’ll probably see F# code in this blog in the coming months.

But what about Visual Basic, the direct descendant of the programming language that gave Microsoft its start?

I used to make a living writing custom Visual Basic applications for small- to medium-sized companies back in the 1990s, before the .NET era. It was the quickest way to build a fully-functioning Windows application. The drag-and-drop approach to building an interface meant that my business partner, the business rules/human factors guy, could build simple prototypes off which I’d build the actual program. The low barrier to entry presented by the Visual Basic language meant that our customers – who knew their business much better than we did -- could make changes to the code (they’d make mostly small changes, but they appreciated not having to call us and pay a consulting fee for every little change).

I haven’t touched Visual Basic since those days. I remember the “Visual Fred” fuss that some developers made when Visual Basic went .NET; they said that Microsoft had ruined the spirit of the original language and simply turned it into C# in Basic clothing. I remember reading articles that said that given the choice between coding in Visual Basic.NET and C#, you should pick C#, partly for technical reasons, partly for financial ones (they hinted that people would pay a “C# developer” more than a “Visual Basic developer”.

C# seems to have “preferred status” in the world of managed-code .NET, judging from a quick look at the books and sites out there. I personally prefer it to Visual Basic .NET, but I wouldn’t be doing my job if I were ignoring an audience of Visual Basic developers. So I thought I’d ask you, the people who build on Microsoft’s platforms: Do you code in Visual Basic?

And if so, do you do it because it’s your preferred programming language? Or it is because your company has standardized on it? Or that you’re maintaining projects written in VB.NET? Or something else?

And just as important, if I post code examples in C#, do you want me to post equivalent code in VB.NET, or are you happy to work it out on your own?

Let me know, either in the comments or drop me an email. I’d like to know, because I’ll use that information to shape future articles on coding.

Comments (30)

  1. Clint Ecker says:

    No. Why would I or anyone beyond those forced to use VB, use it. It is like apple’s applescript. Utterly braindead and proprietary. It is not fun to use, it is not even easy to use.

    All the abstraction is in all of the wrong places and people who are forced to use it tend be on the lowest end of the programming spectrum.

    Let me make this clear, if you CARE about programming and are GOOD at programming, you would not choose to use VB.

  2. Ruslan Urban says:

    I had to code in VB.Net only a few times since I switched to C#, and only to maintain existing code.

    I am finding C# much more elegant, easier to read and much more pleasant to work with compared to VB.Net. But, that’s my own opinion…

  3. Srdjan says:

    I only code in Visual Basic, because I have to. It’s for my part-time job with a startup and my friend had already started on a ASP.NET app in VB. I don’t like it, in fact, I’m growing to hate it.

    I think it’s the fact that it’s close to C#, but with important differences that make development frustrating. I had one of those differences bite me last night. I was trying to initialize the Castle ActiveRecord framework in global.asax, but the example code was in C#. One of the arguments is a typeof(<some object>). Now, Intellisense will show TypeOf keyword for VB, but the code will fail to compile, since it’s a different semantic from typeof keyword in C#. The proper statement in VB is actually GetType(<some object>), as you probably know.

    It’s crap like this that makes it hard to write VB code, especially if parts of your project are C# or IronPython or IronRuby or whatever.

    So, while I’d love to see F# code, I wouldn’t particularly want to see VB.

    Sorry for the rant.

  4. Rachel Carvalho says:

    I guess I’m too young to have coded in VB6 (or less) but I have started in .NET development with VB.NET. I then went over to C# and today it’s my preferred language. But I have no problem with moving over to VB and back to C# when needed. Almost every previous job that I had required at some point to know "the other" language.

    Anyway, I’ve got nothing against VB.NET, but C# won my heart 🙂

  5. Joey deVilla says:

    Clint: I get the feeling that Bill Gates felt a disturbance in the Force when you typed in your comment. Thanks for letting us know what you think!

    Ruslan: It’s your opinion we wanted, so thanks for expressing it!

    Srdjan: Oh yes, you *will* see some F# code here. I may even get some guest articles written by the guys at the local F# user group here in Toronto. (Yeah, there’s a user group for just about every language here — there’s even an Erlang pub night, which I have to drop by sometime.)

    Rachel: Thanks for the feedback!

  6. Steve Syfuhs says:

    VB is a wondeful language, for what it did.  I’m a C-style guy…I like my curly brackets, but VB did have a certain something for it’s ‘end’ keywords.  It’s great for students, and if you want to make xml literals.  Otherwise, stick to C#.  Or even C++… Now that(!) would be fun.

  7. I do a lot of coding in both C# and as well as VBscript.  I started out as a VB6 coder – easy to get a UI written as well as being the standard for office automation work.  For .NET projects, I prefer C#, but everyone once in a while still end up working with for projects that I have taken over from others.

    I still use VBscript, for quick and dirty scripting jobs, simple Office automation, and system administration work.

  8. Ken Rachynski says:

    We have a LOB project in conjunction with Autodesk Consulting that is currently in VB6 and in plans to upgrade to VB.NET.  It’s easier to hit the ground running with VB than anything else.

  9. Justice~! says:

    VB is for *losers*.

    Thank you!


  10. Behdad Baniani says:

    what i can say is that VB.NET makes you lazy!

  11. I recently converted a series of C# code generation templates to VB.NET. During the side-by-side port I  was constantly reminded of why I choose C#. The amount of typing required to complete complex statements in VB.NET is easily 2 to 1 over C#. My hands don’t appreciate that.

  12. Grant Palin says:

    My first taste of programming was VB6. From there, I tinkered with several other languages including JavaScript, Java, C++, and Scheme. Now, VB.NET is my primary go-to language when working in .NET. I have a number of projects in VB.NET, and some in C#, but I just prefer VB. I’ve always like the explicit, English-like syntax, I think it’s quite readable.

  13. Ang3lfir3 says:

    VB was where I started in HS… then later moved on to Java… I did a lot of work in corp america in VB and VB.Net and later moved to C# mostly for the tooling as it had prefered status. I continue to use VB.Net and VB as required while maintaining projects that are written in them.

    SO in short… I use VB.Net sometimes but less than I used to … and that is kind of a shame..

  14. Anton Nguyen says:

    I learnt VB in high school, then moved on to java and python during University.

    However, when I started working, I had to do a lot of VBA, since I was working primarily with access, excel, word, infopath applications.

    Now at my current job, I am working with, and the company has chosen to use VB.NET.

    So what’s my verdict? I like it. My favourite language still is python, but I don’t mind VB at all. Its quick and easy, satisfies most of my needs, extremely easy for making prototypes, mock ups, etc…

  15. Rob Windsor says:

    For the most part, I code in the language that my client asks me to use. Lately that has been C#, VB, and JavaScript.

    Personally I don’t have a preference between VB and C#. For certain specific tasks I’ll lean towards one language over the other (Office automation is currently far easier in VB for example) but those tasks are generally edge cases. For the vast majority of day-to-day development, I find the two languages and their associated tools to be functionally equivalent.

  16. Rob Windsor says:


    Your comment made me laugh. It’s a geeked up version of the Steve Martin bit, "… typeof is GetType; var is Dim; it’s like VB has a different keyword for everything!"

  17. Randy Glenn says:

    I use from time to time for one-off projects, often involving (horrors!) the serial port. It’s pretty easy and quick to get a GUI frontend for an Arduino project slapped together, and the people I’m working with can generally make heads or tails of the code (they can handle braces and semicolons on the Arduino apparently, but C# is "too hard").

    I think VB.Net doesn’t get a fair shake, but then, I’m working right now in PHP development – and it’s not 5. As with many things, I think the tool is secondary to knowing how to use it.

  18. grauenwolf says:

    I prefer VB because I can get the same work done with far less code. C# is far too picky about things that are completely pointless.


    C# + LINQ you always have to include a "select" clause. LINQ itself doesn’t require it, it is purely a C# issue.

    C# requires that you sprinkle "break" keywords all over your switch blocks. And you can’t use ranges or comma-separated lists, you need to repeat "case" over and over again instead.

    C# requires you to initialize all local varaibles. The .NET runtime doesn’t require this, again this is purely a C# issue.

    C# requires "return" statements from functions even when you aren’t necessarily returning anything.

    C# requires extraneous parens everywhere.

    C# requires you to specify "ref" when calling functions that pass arguments by reference.

    C# doesn’t allow multiple variables in using blocks, you have to chain them together.

    C# doesn’t have with blocks, making for redundant code.

    C# doesn’t support late binding, instead forcing us to use a ton of reflection code.

    C# doesn’t support optional parameters, which make COM programming painful.

    C# doesn’t support XML literals, leaving us to use the old, clumsy object models.

  19. Dan Godfrey says:

    I code in simply because I have to. It seems to be the standard in the federal government, at least its a step up from cobalt… "hmm ok its 2009 lets port our old cobalt code to something new, any suggestions?" "I’ve got! I just read an article about this great new language Visual Basic. *as he pulls up an article on his commodore 64*, I exaggerate but still. I do find that alot of tutorials and forum post solutions for .net issues are in either c# but in the .net framework its pretty easy to translate.All in all isnt so bad, and it would be awesome id VS added a drag and drop MS paper clip lol  

  20. grauenwolf says:

    @Graham Sibley

    I;m willing to bet you are using VB wrong. I’ve seen countless C# developers add tons of extraneous crude to VB code because they think it should look like C#.

  21. Tarval says:

    I code in VB.

    My last job, it was because the primary client preferred it.

    In this job, it’s just because the project I’m on started with it.

    If I had the choice, I’d choose C#. I don’t mind VB, but C# makes me happier. I’m honestly not sure why.

    I can work out the VB from C# examples, but sometimes not needing to is nice.

    Uhhhh, yup.

  22. Clive says:

    10 text$ = "Please Don’t Deprecate it!"

    20 print ucase$(mid$(text$,10,1)+mid$(text$,9,1)+right$(text$,1))

    30 goto 10

    40 REM Seriously, had to Fedex a DVD today because VC 6.0 (C not BASIC) isn’t available

    50 REM for download from MSDN any more!

  23. Joey deVilla says:

    Thanks for the feedback, everyone!

    I also got some email and Twitter direct messages, which I’ll summarize in a later post.

  24. Danny V says:

    I use VB for quick UI based programs. It was the second language I learned (the first being good ol’ QBasic) in high school and I find it very useful for my purposes.

    I haven’t programmed nearly enough to go into an in depth discussion of the language, but if I want a quick, small, UI based application I’ll be choosing VB over anything else.

    (I was upset that the ability to easily make control arrays was removed from .NET. In high school we created many games using control arrays as a ‘backbone’)

  25. Kate Gregory says:

    I strongly prefer VB.NET to C#. I have said out loud "C# is just VB with semicolons" on more than one occasion. Apparently Anders has even heard me say it, and the ground didn’t open up and swallow me whole so I can keep saying it. I love the "VB is for people who are not smart enough for C#" comments. VB is the managed language I prefer, and I am smart enough for C++, C++/CLI, and C++0x (heck, I am smart enough to make JOKES about C++0x and that takes some doing) so thhhpt to the "not smart enough" folks.

    I prefer VB for three reasons – it is clearly and obviously not C++, which helps me context switch; it requires less typing even though its keywords are longer; and my clients (falsely) believe it will be easier for their own staff to maintain or (perhaps correctly) cheaper to hire staff to maintain it when I have finished writing it for them. Also, the typing advantage used to be far stronger, and I got used to it during that time.

    I am not saying VB3 was a great programming language, or even that VB6 was (though it sure solved a ton of busines problems.) But people who formed their opinions of VB then and refuse to change them are, er, hard to describe politely.


  26. Renee Kraft says:

    Yes I do.

    I still maintain (and even develop) many small and medium biz solutions that require VBA. I’m so used to VB.NET (and previously VB 6) and I don’t see any advantage of switching to another language. Perhaps my choice of language isn’t cool – my apps are!

  27. RobinDotNet says:

    I used to code primarily in VB, but now I program in C# because it was my company’s choice. The two languages are very close, give or take XML Literals (available in VB but not C#) and anonymous methods (available in C# but not VB).

    BUT, I can program faster in VB than I can in C#. The compiling-as-you-go is fabulous, I don’t have to do the make-a-change-then-build, make-a-change-then-build, make-a-change-then-build, make-a-change-then-build, make-a-change-then-build cycles.

    The intellisense is much stronger, it finishes my sentences for me and puts in my "Ends" (If/EndIf). It’s not case-sensitive and it corrects my variables to the capitalization I used when I defined them.

    I don’t have to put semicolons at the end of every line, and I don’t have to eyeball the curly braces to make sure I didn’t miss one, and that they line up.

    The methods have a line between them in Visual Studio when you’re using VB, which makes it easier to see your endpoints. And inserting code snippets is easier in VB, and there are a lot more of them for VB than C#.

    And I’m sorry, but AddHandler is a lot easier to instantaneously get than +=. Seriously.

    Of course, C# has those wonderful anonymous methods, and I have to admit, the curly braces are cute. (I can’t help myself, I’m a girl.)

    The only difference between the two languages is pretty much spelling (except did I mention XML literals, which C# doesn’t have, and anonymous methods, which VB doesn’t have?).

    So if you think you can do more in C# than in VB, you don’t know enough about VB. And if you think you can do more in VB than C#, you don’t know about C#.

    I think it’s important to be ambidextrous and know how to read both, and honor other peoples’ choices. I can do both, and although I find C# pickier, I can live with either one. The important thing is to get the job done in the best way possible, no matter which language you choose.

  28. Tony Curcio says:

    I do code in VB.NET. I also teach development theories using VB.NET to post graduates studying GIS. For me, the best and most effective approach is to teach VB.NET. We study object oriented programming using VB.NET as that is what the job descriptions are asking for.

    Dollar for dollar, VB.NET achieves the greatest impact for these students.

  29. Trish Rempel says:

    I code in VB.Net because that is my company’s standard. I agree with RobinDotNet that there aren’t that many differences compared to C#, and I have no problem reading both or switching back and forth.

  30. Aaron Cook says:

    In any software project maintenance is the number one cost associated with software development.  I’ve seen the "quick and easy" VB apps that have been strewn about – completely fragile and unmaintainable with all of the VB goodness like hundreds of untyped globals wrapped in spaghetti.

    Grauenwolf’s comments on C# being picky – these are constructs which show the programmers intent and therefore make maintenance easier and programs cleaner, these are not completely pointless.  Pointless is using the word Dim in front of every variable declaration, it has no semantic value and does nothing to convey the intent of the programmer.

Skip to main content