VB.NET – No “__DATE__”! And Other Bugs

I was doing a lot of VB.NET in my most recent job.

One problem I had was that my bosses were reviewing old versions of the program.  They were complaining about things I had already fixed.  I decided to put the version number on the screen, so I can always be sure what version they’re using.

In the days of C/C++, I used __DATE__.  The preprocessor replaces __DATE__ with the current date.  This makes it easy to display the compile time and version on the screen.

I was shocked that VB.NET does not have __DATE__!  There is no equivalent!  WTF was Microsoft thinking?

I use the Visual Studio “publish” feature.  It automatically increments and tracks version numbers.  THERE IS NO EASY WAY TO EXTRACT THE VERSION NUMBER.  (You can do it, but it involves jumping through some hoops.)

I wound up using subversion’s $rev$ and $date$ feature.  That’s still flawed, because it shows the timestamp of THAT FILE and not the whole program.  I.e., if I didn’t edit that specific file for a week, then $rev$ and $date$ in that file are a week old.

I know that in C/C++, I can have array of struct with 100,000+ rows and it’s fine.  In .NET, if I put more than 10,000 rows into a DataTable or a DataGridView, VB.NET chokes on it.  WTF?  Why should 10,000 rows cripple the runtime?

VB.NET is better than the old C++/MFC.  If you want a dynamically resizing window, the splitcontainer/anchor/dock feature is nice.

I’m annoyed that some “obvious” feature are missing from VB.NET.  There’s no equivalent of __DATE__!  There’s no easy way to extract the publish version number.  If you put more than 10,000 rows in a DataTable or DataGridView, it starts getting slow.

6 Responses to VB.NET – No “__DATE__”! And Other Bugs

  1. System.windows.forms.application.version

    10, 000 rows sounds too much to view. You can easily break it up and add your own next and previous buttons. SQL does allow you to return only the first _x_ rows of a result set. Can’t remember what it is – where rowcount < 1000 ?????

    • Really? I thought I tried that.

      I was required to load the whole table. In C/C++, 10,000 rows is no problem. I was surprised that VB.NET couldn’t handle that.

  2. I made a mistake it is

    .Application.ProductVersion

    Maybe you aren’t writing a desktop Windows forms application. If so, it might not be available. You set the product version in the AssemblyInfo file.

    The MSDN library was good with Visual Studio 2008. In Visual Studio 2010, the MSDN library has turned to crap. I suspect Microsoft has moved form a desktop application into an HTML browser one and messed up the MSDN help in the process.

  3. Maybe you should have as a rule:

    1) All employers and companies that use Visual Basic are idiots. All code in VB is rubbish written by clowns.

    2) Avoid all companies that have anything to do with Lotus Notes.

    • I usually use the web-based version of MSDN help, rather than the F1 help. I use Google to search Microsoft’s website, because Bing gives horrible results!

      VB.NET was more awful than I expected. I looked into putting the version #, but couldn’t figure it out. I think I tried that code, but it always came out as 1.0.0.0.

      It was better than MFC. However, there were some bugs that made me say “WTF? Seriously?” For example, if I try applying a RowFilter to a DataTable bound to a DataGridView, and there’s lots of rows, it can become non-synchronized. I.e., the filter is supposed to show 100 rows but 200 rows actually display. I found an ugly workaround. I kept changing the filter and looking at Rows.Count until it matched!

  4. The manifest file contains an application version number, but I don’t think it is read from there. I think it is AssemblyInfo. You can set the version number in project properties.

    Application.ProductVersion should work if you are using a windows forms desktop application. Maybe it gets messed up if you use the publish feature. I don’t use that myself. The more Microsoft functionality gets into the mix, the more likely things are to blow up in your face!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>