Cheap means of eliminating VB.NET

This company: elegancetech has a utility called C Sharpener for Visual Basic.
$99 dollars for a single user licence looks to be very good value.

This would be great for C# shops that have to take over maintenence of VB.NET code.

While it is great that .NET allows cross language work life is much easier if a shop sticks to one language. It would be a different matter if the two langauges were different in their expressiveness (say a functional language versus an OO one) but having two similar languages adds nothing to the mix.

I have nothing against VB.NET itself (Visual Fred), as it has finally gained the language features (inheritance, sane error handling) that Delphi has had since version 1 (10 years ago). The problem is the 3 million claimed VB (VBA) programmers. While the top few percent of those are likely to be decent devlopers the vast majority have the programming experience of  record macro then (possibly) edit. This leads to unmaintainable code. I have worked alongside professional VB developers whose idea of code reuse within a project consisted of cut-and-paste at best and the creation of reusable routines was a novelty.

Great SQL Server Error

When attempting to:

ALTER TABLE MYTABLE ALTER COLUMN TIMESTAMP varbinary(8) NULL

The following error is raised:

Cannot alter column ‘TIMESTAMP’ because it is ‘timestamp’.

You have to do the following:

ALTER TABLE MYTABLE DROP COLUMN TIMESTAMP
ALTER TABLE MYTABLE ADD TIMESTAMP varbinary(8) NULL

What is a Non-CLS Compliant Exeception and why should I care.

While studying for Exam 70-316 (Developing and Implementing Windows-based Applications with Visual C#.NET and Visual Studio.NET) I found that the .NET framework has what is known as a “Non-CLS compliant exception”

While investigating this I found the following article on how to implement a bulletprof main routine:

    Sample of how to implement the main routine of an application.

Pop Quiz for Delphi developers : what is the most basic class that can be thrown as an exception?
The obvious answer of Exception is wrong – you can raise a TObject or descendant (TForm?)- just don’t expect your exception handers to work.

The .NET CLR has this great base Exception class.
So why do they need to allow anything else!
Why not define a ENonCLSException descendant and raise that!

It appears that IL allows a System.Object to be thrown in exactly the same way as Delphi!
The above link includes a sample of how do do this.

The moral of this tale is that your default exception handler needs to finish with a generic catch clause. I need to look into how to add my own template application to the defaults in VS.NET – some of these need to be created by default.

More usability issues

The .NET TextBox class when set to multi-line is a very weak control compared to Delphi’s rich TMemo control. TMemo exposes a Lines property to which a line of text can be simply added r individual lines manipulated. I need to look at the TStringList for C# to see if I can use it to create a fully featured TMemo for .NET.

            textBox2multiline.Text += System.Environment.NewLine + “This is a test”;

is far more code (and far less obvious) than:
 
             memo1.lines.Add(‘This is a test’);

In addition when you rename a delphi control if the text property matches the control then the text property changes as well. I wonder if the designer could be extended that far? This makes editing controls much easier – first you rename them and then you customise that into the correct text. This is far more efficient.