Visual Basic 2010 Evaluation and Criticism

Purpose

The purpose of this document is to write down my experience with Visual Basic 2010 compared to Visual Basic 5.0
If someone would ask me is Visual Basic 2010 an improvement than my answer would be No. It is too complex.
For additional information about Visual Basic 2010 please read this: Visual Basic 2010 Parallel Programming

Content

  1. The signer's certificate is not valid for signing.
  2. Program Mode versus Designer Mode
  3. Documentation
  4. Documentation - Help viewer
  5. Parallel Programming
  6. How to draw a point
  7. How to use arrays with the Toolbox ?
  8. How to combine text and values in Messages
  9. Not a Number (NaN)
  10. File structure
  11. New Application building
  12. Form size problem
  13. Time and Timer function
  14. What is new in VB 2010
  15. Reflection part 1
  16. Reflection part 2
  17. Feedback


  1. The signer's certificate is not valid for signing.

    The original Visual Basic 2010 package was loaded under the umbrella "Visual Studio 2010 Professional". As part I received a product key. However this key is not longer valid. To solve this I reloaded the package but now under the umbrella "Visual Basic 2010 " I also received a new product key.
    This new key does not cause any problem for new programs written but I cannot publish my old programs any more. Instead I get the error message:
    Error 3 An error occurred while signing: Failed to sign bin\Release\app.publish\\setup.exe. SignTool Error: The signer's certificate is not valid for signing.
    SignTool Error: An error occurred while attempting to sign: bin\Release\app.publish\\setup.exe Fibonacci
    To solve this problem I had to rebuild all my programs. To do that you have to rename the old Fibonacci project into Fibonacci-old and create a new Fibonacci project.
    In the case of the Fibonacci project you have to copy the files: Form1.vb and Form1.Designer.vb. This whole process is a nuisance
    The cause is the file: Fibonacci_TemporaryKey.pfx
    Microsoft should remove this whole philosophy.

    When I load the projects Planet or Fibonacci I get the following error message:

    Value cannot be null / Parameter name object type / Line 0 / Column 0
    To solve this problem is a nightmare.

    You can of course go back to old installed versions but that sounds like entering in a dark cave with absolute no light.

    After roughly 4 hours of testing I found the cause:

    • In the program Planet in the line:
      Private Sub startAsyncButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startAsyncButton.Click
      The name startAsyncButton.Click should have been with a capital S.
    • In the program Planet in the line:
      Private Sub cancelAsyncButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancelAsyncButton.Click
      The name cancelAsyncButton.Click should have been with a capital C.
    • In the program Fibonacci in the line:
      Private Sub backgroundWorker1_DoWork(ByVal sender As Object, ByVal e As DoWorkEventArgs) Handles backgroundWorker1.DoWork
      The name backgroundWorker1.DoWork should have been with a capital B.
    • In the program Fibonacci in the line:
      Private Sub backgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs) Handles backgroundWorker1.ProgressChanged
      The name backgroundWorker1.DoWork should have been with a capital B.

  2. Program Mode versus Designer Mode

    If you compare Visual Basic 5.0 with Visual Basic 2010 than one of the major differences is that the first consist of one VB program (complex) and the second of two VB program (complexes).
    Suppose you have a project called planet than
    • In the Visual Basic 5.0 the program is called: planet.bas (module and subroutines) and the form: planet.frm. The form contains the subroutines activated via the pushbuttons.
    • In the Visual Basic 2010 environment the programs are called: planet.vb and planet.designer.vb
    In the Visual Basic 5.0 environment during the building of the form you can insert a text box, a command button or a label in a form. The information of those actions are stored as text in the form invisible for the user. The subroutines which are directly invoked as a result of operator actions (Click and double-click) are also stored in the form.
    Suppose you what to place 9 text boxes and 9 labels in the form of a 3 by 3 matrix on your form. To do that you can use the subroutine Form Load to place the boxes and the labels at the position you want. What is important you can also calculate those positions. If you for example use a parameter distance and you change its value than all the new positions are calculated. All this is very user friendly.

    In the Visual Basic 2010 environment the building of the form from the user point of view is almost identical. You can insert a text box, a command button or a label in a form. However and that is different, at the same time the planet.designer.vb program is updated with that information. You can modify that program, you can change the position if you want, but you cannot use any mathematics. That means you cannot calculate the position on the form.
    If you want to calculate the position you have to build your own initform subroutine to do that. In fact there are two initialization subroutines: one is the designer initialization subroutine the second one is your own initform.
    What you can also do is to build the whole form in your own initform subroutine. However that is even worse. See
    Fibonacci benchmark

    There is a difference between building the form. When you insert your first text box you this difference does not show up. IN visual Basic 2010 when you insert the second text box the system draws horizontal and vertical lines to make it easy that you place the box horizontal and vertical at the correct position. This seems an improvement but it is not. The problem becomes clear in the 3 by 3 example if you want to change the box in the middle: the lines become messy

    IMO this whole new concept of Designer Mode has no advantages only disadvantages specific because of the added complexity.


  3. Documentation

    Documentation in Visual Basic comes in two colors:
    (1) Microsoft MSDN documentation and (2) Documentation via de "Help" tab in Visual Basic.
    • First the MSDN documentation
      1. With Google when you type "Backgroundworker Class" you get the following MSDN document: Backgroundworker Class The document shows two Examples: "BackGroundWorker" and "Fibonacci" The problem that the two examples explained are for the language c#. That is not very helpful
        What you want is an example which uses Visual Basic.
      2. With Google when you type "Threads and Threading" you get the following MSDN document: Threads and Threading
        This document explains what threads and threading are from a technical point of view. The problem is that threads and threading is important for processors that have multiple core's (CPU's) but not important for the average Visual Basic user except if he or she wants to use parallel programming. But that is not explained.
        In the paragraph "Threading and Application Design" the concept Backgroundworker is mentioned. That is the only important information. However .. this brings you back to the previous document which is not what you want.
      3. With Google when you type "Parallel Programming MSDN" you get the following document: Parallel programming
        The title of the document is: "Parallel Programming in the .NET Framework"
        This document starts with the text:
        To take advantage of the hardware of today and tomorrow, you can parallelize your code to distribute work across multiple processors.
        That is correct. The sad thing is this document does not tell you anything how you do that and what is involved when you want to use Visual Basic.
      4. With Google when you type "Using the Parallel Tasks Window" you get the following MSDNdocument: Using the Parallel Tasks Window
      5. With Google when you type "Using the Parallel Stacks Window" you get the following MSDNdocument: Using the Parallel Stacks Window
        Both MSDN documents 4 and 5 give a complete wrong impression about what is involved in parallel programming with Visual Basic.
      In short the usefulness of those document related to actual programming is rather mediocre.
      There is one more link to study Visual Basic language Reference but the information supplied is not very helpful
    • Secondly the "Help" documentation.
      1. Select in search box (Not via Index) "Backgroundworker Class"
        More or less the same information is supplied as above under MSDN documentation #1.
        The document shows two Examples in Visual Basic: "BackGroundWorker" and "Fibonacci"
        Both programs use the BackGroundworker. But they do not demonstrate Parallel Programming
      2. Select in search box (Not via Index) "Threads and Threading"
        More or less the same information is supplied as above under MSDN documentation #2.
      3. Select in search box (Not via Index) "Parallel Programming"
        What you get is a document which starts with the title: "Parallel Programming"
        Select: "Parallel Programming in the .NET Framework"
        The document (Which I expect resembles MSDN documentation #3) is not available.
      4. Select in search box (Not via Index) "Using the Parallel Tasks Window"
      5. Select in search box (Not via Index) "Using the Parallel Stacks Window"
    My overall evaluation of the "Help" documentation is mediocre. To find the information what you want is difficult.
    There are two ways: (1) Via the index (2) Via the search box in the top right corner.
    • Via the index is only okay if you already know what you want to read. There is no match for "Threads and Threading"
    • Via the search box you get an avalanche of information which is also not very usefull.

    Go to Visual Studio Help Viewer
    Select "Index". You will get a table with roughly 10000 entries (?)
    Go to the Bottom. The last entry is: Zs compiler
    Select the top arrow at the right side of the "Index" frame. The entries will move downwards continuous. I went until Xps
    Select the bottom arrow at the right side of the "Index" frame. The entries will move upwards. However after a short time this movement stops and you have to move your pointer. stops again. stops again.
    I expect this is a system error


  4. Documentation - Help Viewer

    The Help Viewer consists of two parts: A left part and a .
    The Left part has 4 Tabs: Contents, Index, Favorites and Results.
    The biggest problem of the Documentation is that it is a mixture of the language Basic, C# and C++ under the umbrella of Visual Studio. That is user unfriendly. I hope that when you have Visual Basic that the documentation only explains Visual Basic and nothing more
    • when you select the Contents tab, it is rather difficult to find the information you want. There is no search tool under the Contents tab.
    • Select the Index tab. You get a tremendous long list which is very user unfriendly. The Index tab has a search tool. Type Yellow. You get information on the right part, but the Contents tab page is not updated.
    • Type treading in the top right search box.
      The results section shows 100 hits. Many of those are related to c++ and C# and that is not what you want.
      Many of those are related to .NET Framework 3.5. The reason is not clear.
      There is no relation with the Contents tab and that is also user unfriendly.
      Type Timer in the top right search box. The list of options is too large and completely unpractical.
      Type Timer Visual Basic in the top right search box. The first entry in the results is: "Visual Basic Runtime Library Members" That is not what you want. What you want is the time in seconds.

    My overall evaluation of the documentation is poor.


  5. Parallel Programming

    First the good news. Parallel programming as implemented in Visual Basic 2010 (i.e. its general structure) is very powerful tool when you use the Backgroundworker. I expect that the writing of those two documents is not much fun. There is too much detail which should be solved by the operating system, which the backgroundworker perfectly does.
    The writing of the ISA SP standard for batch processes was on the contrary a lot of fun.
    See: ISA-SP88, Batch Control If you follow the links you almost get no information about the actual document. This is sad because the whole standard was developed by volunteers and IMO should be available for FREE

    And now the bad news: When you consider performance, that means if you have one application (i.e. one physical problem or simulation) and you want to improve performance by modifying that application and by adding parallel programming in the form of the backgroundworker, that whole exercise is more or less useless, because the overall performance will not increase. See for detail: CPU performance Part 1 and CPU performance Part 2


  6. How to draw a point

    In Visual Basic 5.0 that feature is supported by means of the PSET(x,y) statement. Using that feature you can draw any curve and is a must for almost any scientific application
    In Visual Basic 2010 you more or less go in two steps:
    1. First you set the pixels in a bitmap using SetPixels(x,y,color)
    2. Secondly you "link" your bitmap to a PictureBox
    It works. For example see
    Visual Basic 2010 program: Maze - Create your Maze Without Using labels

    In Visual Basic 5.0 it is easy to place Text at any place on a form by using a Picture Box.
    The following program shows an example:

    Private Sub Command1_Click()
         Form1.Picture1.PSet (130, 130), 0
         Form1.Picture1.Print "Test"
    End Sub
    
    How do you do that in Visual Basic 2010 ?
    By using Printer Class (VB 6.0) or by using PrintDocument Class ?


  7. How to use arrays with the Toolbox ?

    IMO it is not possible to define the names of the tools from the Toolbox as arrays on a Form in Visual Basic 2010. In VB 2010 the name of for example each textbox is always a string.
    In Visual Basic 5.0 such a name is also a string but this string can also be an array. The advantage is when you have a large TextBox array and you want to copy values becomes easy by using the loop statement of the for statement.
    IMO this is a very serious omission.


  8. How to combine text and values in Messages.

    In Visual Basic 5.0 if you want to print a messages any combination of text (strings) and values is possible.
    For example a statement like: debug.print "a =";a; "b = "; b;"c = "; c
    is completely legal
    The result will be: a = 0.8 b = 1.25 and c = 234,12
    In Visual Basic 2010 such a statement is not allowed.
    This becomes: debug.print "a =" + str(a) + "b = " + str(b) + "c = " + str(c)
    That means you have to convert values to strings. This is no improvement.
  9. Not a Number (NaN)

    Visual Basic 2010 uses the Not a Number concept. If you divide zero by zero the result becomes Not a Number or NaN. If you use that result in another calculation the result also becomes NaN. This means for a simulation of the planets around the Sun that all the positions become NaN.
    The whole NaN concept is a horrible concept. IMO when in any calculation you divide one number by zero during program execution the "operating system" should declare this event as an error (Because something in the program is wrong which requires a modification) and the program should stop.

  10. File structure

    Compared to Visual Basic 5.0 the file structure is becoming too complex.
    In Visual Basic 5.0 all the files for all the applications are stored in one map called USERS. Each application or project requires 5 normally files. (This number can be larger if more forms are used)
    In the case of application VStest1 this are the 5 files: VStest1.bas, VStest1.frm, VStest1.vbw, VStest1.vbp and VStest1.EXE
    In the case of VB 2010 the file structure (Only for project Planet) is the following:
    Projects (Map)
        Planet (Map)
           Planet.suo   Planet.sln
           Planet (Map)
              Planet.vbproj PlanetForm.vb* PlanetForm.Designer.vb* PlanetForm.resx  
              PUBLISH (Map)
                 Planet.application setup.exe
                 APPLICATION FILES
                    PlaNET_1_0_0_0, PlaNET_1_0_0_1, .... PlaNET_1_0_0_6
                    PlaNET_1_0_0_7
                       Planet.application Planet.exe.manifest Planet.exe.deploy
              BIN
                 PlanetForm.vb
                 DEBUG
                    Planet.application P.exe P.exe.manifest P.pdb P.xml P.vshost.exe etc
                 RELEASE
                    Planet.application P.exe P.exe.manifest P.pdb P.xml
                    APP.PUBLISH
                        Planet.application setup.exe
                        APPLICATION FILES
                           PlaNET_1_0_0_7
                              Planet.exe.manifest Planet.exe.deploy
                 PUBLISH
                    Planet.application setup.exe
                    APPLICATION FILES
                       PlaNET_1_0_0_0, PlaNET_1_0_0_1, ... PlaNET_1_0_0_5
                       PlaNET_1_0_0_6
                          Planet.application Planet.exe.manifest Planet.exe.deploy
              MY PROJECT
                 appl.manifest appl.designer.vb resources.designer.vb settings.designer.vb etc
              OBJ
                 X86
                    DEBUG
                       Planet.exe P.application P.pdb P.xml etc etc
                       TEMPPE
                          My Project.Resources.Designer.vb.dll
                    RELEASE
                       Planet.exe P.application P.pdb P.xml etc etc
                       TEMPPE
                          My Project.Resources.Designer.vb.dll
    
                          Figure 1  File Structure of Project Planet.
    
    The names in capital letters are Maps.
    The file PROJETS contains 1 Map: Planet
    The file MAP contains 1 Map and 2 files.
    IMO this whole structure is too complex and an overkill.
    The name of the executable program is Planet.exe.
    If you want to change this name than you have too build a complete new project
    It is not possible to change the name of the Map "Planet" (Direct below the Map: "Projects") into this new name.
    In Visual Basic 5.0 this is no problem

  11. New Application building

    Suppose you want to build a new application based on an existing application how do you proceed ?
    To be more specific: I want to build a new application Planet1 based on Planet.
    1. Part 1 Create a New Project Called Planet1
      1. Start Visual Basic and select: New Project.
      2. Select: Windows Forms Application
      3. Go to MY PROJECT and change "Assembly name:" and "Root namespace:" from WindowsApplication1 into Planet1
      4. Select Form1.VB. Change Form1 into Planet1Form
      5. Go to File Next: Select Save All Next: Change WindowsAppication into Planet1 Next: Select Save All
      6. Terminate Visual Basic
    2. Part 2 Copy the two files indicated with a * (See figure 1) from the Map Planet to the Map Planet1
      1. Select Source Map. Go to Projects. Select Planet. Select Planet
      2. Select Destnation Map. Go to Projects. Select Planet1. Select Planet1
      3. Copy PlanetForm.VB from Map Planet to Map Planet1. Delete Planet1Form.VB
        Rename PlanetForm.VB to Planet1Form.VB
      4. Copy PlanetForm.Designer.VB from Map Planet to Map Planet1. Delete Planet1Form.Designer.VB
        Rename PlanetForm.Designer.VB to Planet1Form.Designer.VB
      5. Start Visual Basic. OPen Planet1 Project. There should be one Error.
      6. Select Form1 Change name from PlanetForm into Planet1Form
      7. Go to File. Next: Select Save All

  12. Form size problem

    In a "Windows Forms Application" the standard way to execute the application is via a form. Normally the size of the form is as designed. In the VStest2 application the form was more than twice as large. I do not know exactly what caused this. The error was in the VStest2Form.designer.VB file. For more detail about VStest2 See:
    CPU performance

    In each application when the user implements an application two VB files are created.
    In the case of VStest2 this are the files: VStest2Form.VB and VStest2Form.Designer.VB

    • The first one VStest2Form.VB is created when the users implements Visual Basic.
    • The second one VStest2Form.Designer.VB is updated by the compiler when the user modifies the Form. For Example when the user adds a label, Modifies a TextBox or changes the size of the form.

    To observe the XXXForm.Designer.VB perform the next:
    1. Go to the Solution Explorer
    2. Go to the "Picture" Select All Files. (Picture # 2). The number of files displayed should expand.
    3. Select the file XXXForm.VB. The number of files displayed should expand.
    4. Select the file xxxForm.Designer.VB
    The central Subroutine in this file is: InitializeComponent() This file is used to build the form and contains the parameters for each control: each label, each TextBox and the Form.
    When you go to the Form part you will see the three statements:
    Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
    Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
    Me.ClientSize = New System.Drawing.Size(433, 189)
    The last statement defines the size of the form.

    In the case of the Form size problem the Form part also contained the statement:
    Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds
    That statement was the cause of the problem and should be removed (or changed as a comment)


  13. Time and Timer function

    In VB 0.5 the Time function supports a time in the format Hr:Mn:Sc Accuracy is 1 second
    In VB 0.5 the Timer function supports a time in seconds. Accuracy is 15,625 thousands of seconds or 1/64 seconds

    VB 2010 supports the Time function by using second(Now), Minute(now) and hour(Now)
    VB 2010 supports the Timer function a time in seconds via DateAndTime.Timer . Accuracy is 15,60 thousands of seconds or 1/64.1 seconds


  14. What is new in VB 2010

    Read this Microsoft MSDN document:
    What's New in Visual Basic 2010
    IMO almost all the features that are new are not necessary.
    One of the new features is covariance and contravariance. For more information from Wikipedia read this: Covariance and contravariance (computer science). For more information from microsoft read this: Covariance and Contravariance in Generics. Specific the sentence: Covariance seems very natural because it looks like polymorphism. Contravariance, on the other hand, seems counterintuitive. is very helpful...
    In mathematics and physics (General Relativity) a different definition of covariance and contravariance is used. For a simple introduction read this:Invariance, Contravariance, Covariance . For a more thorough discussion read this: Covariance and contravariance of vectors.
    Both definitions are completely different. The first has very little practical use in general (may be in c# Variance in C#.NET 4.0 Covariance and Contravariance , so why bother in Visual Basic?

    Try this MSDN document: Structured Exception Handling Overview for Visual Basic
    IMO the The Try... Catch... Finally Statement is not useful to write mathematical oriented programs.

    The following statements can all be removed:
    Delegate, Namespace, SynLock, Throw, Option etc , Yield
    For scientific applications what you need are:
    1. text boxes to enter values and to show results in a "table" (in arrays and columns)
    2. buttons to control the application
    3. picture boxes to show results in a graphical form
    4. A language which allows you to perform calculations. a = (b * c / d) ^ e
    5. A library with mathematical functions.

    More is written in this Microsoft MSDN document: Programming Concepts Visual Studio 2010
    IMO far too much


  15. Reflection - part 1

    Overall evaluation: Visual Basic 2010 is mediocre, specific compared with Visual Basic 5.0
    The problem is what are the design objectives of Visual Basic in general ?
    IMO the primary target audience should be the single individual and the scientific community. The same audience are the people who use Fortran. In fact Visual Basic 5.0 is an excellent tool to write scientific programs.
    The purpose of Visual Basic should not be to develop commercial software or system software. The people interested in developing system software should use C or C++.
    One of the most important features of Visual Basic 5.0 and Excel Basic was that it was the same. That was very important because you could use the same program for both. Of course the user interface was different but the language part to express the mathematics was all the same. Now that has changed. This is sad.
    I expected that Microsoft has enlarged the objectives of VB 2010.
    The result is:
    • An avalanche of tools that the scientific community does not need and which makes the whole package too complex.
    • A very user unfriendly new file structure
    • and too many pop ups with selection messages (advices) or error messages.

    Please keep Visual Basic Simple

    The purpose of the language is to solve a physical problem and to come up with the correct answer using an algorithm. That is why they called the one of the first programming languages
    Algol. QBasic was a perfect platform. The same for Visual Basic 5.0 IMO Visual Basic 2010 is not. It is definitively not basic
    The purpose of the language is not to write a program using the least memory or to write the fastest program. If you want to do that you can better use C or C++.

    David Platt also wrote a review of Visual Basic 6 Versus Visual Basic 2010 in MSDN magazine. For a review of that article go to The silent Majority


  16. Reflection - part 2

    After written many programs using VB2010 the overall evaluation is the same: Not Good.
    1. One of the most new developments in the language is the ToolBox. However most of the tools are of no use and or very are unpractical to use. IMO Microsoft should completely reevaluate the function of the toolbox.

      Tools of the ToolBox are for example:
      Button, Backgroubworker, Checkbox, label, PictureBox, Radiobutton, RichTextbox
      There are in total roughly 50 of those tools. In most cases the purpose is rather obscure.

      The ToolBox works with two concepts: Interupts and Interupt Handlers.
      Interupts are important during execution of the program. In general there is what is called an interupt or event when the user of the program selects a tool from a form. This can be when he wants to modify a value or enter some text. An Interupt Handler is a piece of program that will be executed when the interupt happens.
      The Button tool recognizes the following interrupts:
      Click, DoubleClick, MouseClick, MouseDoubleClick, Validated and Validating
      There are in total maybe roughly 40 interrupts only for this tool. The exact meaning of each is in most cases not clear. What makes this extra difficult is that with certain events there can be more than one interrupt, resulting that more than one interhandler will be activated.
      Each interrupt handler uses as a standard two parameters: sender and e. I think that e stands for error. The problem is that both parameters require special values. All of this makes each tool very user unfriendly.

      My recommendation is to use the toolbox as less as possible.

    2. A general annoyance is the HELP functionality. There should be HELP functionality only for Visual Basic and all examples should be Visual Basic Examples. A lot of the terminology in the Help functionality is very difficult to understand.
    3. In general file reading and writing has drastical changed. Sometimes I get the impression they have made certain changes to improve performance at the cost of easy to use. Speed is not a consideration for a Visual Basic Program. If speed is an issue than you should write your program in a different language (C or C++).
    4. I hope that Microsoft recognizes that Visual Basic is a language to be used by all the people on this Globe, of all types of cultures with all types of skills and educations. The language should be simple to use. That means a should contain a small dictionary of concepts, statements and parameters.

    I strongly hope that Microsoft uses for all its products (Excel, Word, Visual Basic) which require programming the same programming language. That reduces a lot of learning time.

Feedback

None


E-mail:nicvroom@pandora.be.

Created: 26 December 2010
Modified: 2 September 2012
Modified: 30 January 2013

Back to my home page Contents of This Document