Visual Basic Programmer: Access database Programmer

Visual Basic Programmer
Microsoft Access Database Programmer

Custom Built Software 
Sydney, Australia

Moving from Visual Basic to CSharp (C#)

Microsoft Access: The Front-End: Written in Visual Basic.Net or Microsoft Access?The C# (pronounced C Sharp) language is a modern, general-purpose, object-oriented programming language. C# can be used to create Windows desktop, Mobile and Web applications.

Since its launch in 2000, the use of C# has just grown strongly. Many programmers have been attracted to C# due to its similarity to the C, C++ and Java languages.

The use of the Common Language Infrastructure allows low-level procedures to be shared with VB.Net and other languages.

The value of a common Integrated Development Environment (IDE)

The Visual Studio IDE provides support for C#, C., C++, JavaScript, F#, and Visual Basic. Having a common IDE for all these languages has given Microsoft a tremendous boost in productivity. Similarly, the programmer benefits from a common IDE.

If you have a background in VB.Net, you have a head start when starting out on the C# learning curve. You should already be familiar with:

  • Most of the functionality of the IDE
  • Data Access with ADO.Net and the LINQ functionality
  • The Windows Form Application Events
  • The Class Library concepts
  • The Form Designer
  • File Handling

The hardest adjustments

The programmer will need to adjust to using braces, semicolons and a vastly different syntax. And will need to get accustomed to a case-sensitive world, where variable like "Hi", "hi" and "HI" are all different. A big pain.

But the hardest part will be understanding the Object Oriented Programming (OOP) semantic language – let alone the OOP concepts. OOP takes longer to implement and is complex and harder to maintain. It does little to enhance the business logic required for most applications.

Only a very basic knowledge of OOP (mainly Classes and the technique of Encapsulation) is actually required to program effectively in C# (or in VB.Net).

Existing Visual Basic Library procedures may benefit

In converting the VB.Net code, many new procedures (or Methods in C# speak) are bound to be found.

Each new Framework often includes new or better functionality, to ease the programming effort. The C# conversion effort also provides a chance to improve existing VB.Net routines.

Changing from VB.Net to C# in the IDE

There is a facility in the IDE to change to the C# environment. Go to Tools, then the Import and Export settings.

Unfortunately, the change to a C# environment is not complete, and much of the Visual Basic settings still remain. Reinstalling Visual Studio does not help. Use the TotalUninstaller software, to do a comprehensive clean up.

Choose the Keyboard Mapping

The default Keyboard is Visual C# 2005. I am more comfortable hitting the F2 key to show the Object Browser, so I set the Keyboard back to Visual Basic 6.

Converting VB code to C#

The best software that I have found is Telerik Code Converter

The Code Converter will convert a single procedure or an entire Class, with many procedures. The odd problem will arise, but at least a high proportion of VB.Net code will have been translated to C#.

Variables without a Type, Objects and Variants will all need the underlying Type to be set.

C# is a strictly Typed language. If the VB.Net code that you are converting does not use the "Option Strict On" option, it will be best to set the option to "On" Then correct all problems in VB.Net before attempting any conversion.

The "Option Strict On" in VB.Net, as well as enforcing strong Typing, will ensure that all variables are declared and that no automatic conversions occur. "Option Strict On" should be an enforced standard in VB.Net.

Productivity Power Tools

This App is highly recommended. Two options:

  • Format document on save
  • Remove and Sort Usings on save

Both options are helpful in maintaining the C# code.

C# and Maintainability

There may be good reasons for the move to C#. But the weaknesses of the C# language (and its programmers) cannot be ignored. The maintainability problems that will be encountered are:

  • The complexities of OOP
  • The problem with unstructured cowboy programming
  • The lack of self-documentation
  • The lack of READMEs explaining code concepts
  • The lack of a Library of well tested and well documented procedures

The maintainability problems are seldom immediately apparent. It only takes the departure of a key player to make entire systems unmaintainable.

Programming standards must be created from the start – and must be enforced.

And what of the Visual Basic.Net world?

According to the latest survey, of the TIOBE Programming Community index on the relative usage of programming languages, the usage of Microsoft's C# has just pipped VB.Net. Just as C# usage is less than Java, C, C++ or Python.

The relative popularity of C# cannot be judged by the amount of activity on the Web. This is mainly due to the difficulty programmers have in using the language.

VB.Net is a mature, easy-to-use and effective programming language – and will continue to be to the foreseeable future. It will always be much more productive that the C# OOP language. If you need to code and maintain a Business application, VB.Net will always be the way to go.

For the VB programmer's job security, a knowledge of C# could be valuable. But to successfully compete against programmers with training in OOP semantics and OOP design is unlikely.