Browse DevX
Sign up for e-mail newsletters from DevX


How To Prepare Yourself For Moving From VB6 To VB.NET : Page 2

In this article, Jimmy Nilsson makes a few guesses of how you can change your coding style and prepare yourself for the transition to make it as smooth as possible. He will focus on components, especially for the server-side.




Building the Right Environment to Support AI, Machine Learning and Deep Learning


Sometimes you hear that VB6 isn’t good for reusing code because you don’t have implementation inheritance. In my opinion implementation inheritance is just one of several mechanisms for reusing code. You can of course use ordinary code modules for that, but also put code to share in class modules that you instantiate from several other classes.

Several of you might think that code modules are a bit retro, but I use them quite a bit for highly centralized code snippets in my COM+ components. I have had stability problems earlier with other solutions for those snippets and therefore I use code modules and I will leave it that way until VB.NET. In VB.NET I will get more or less the same behavior with class methods (and I can continue to use code modules too if I want).

Saying that you should centralize and reuse code instead of using copy and paste is probably nothing new for you. Still I think that it can be taken even further in most applications that I’ve looked behind the surface of. (That goes for those I’ve written myself too.) If you have a code snippet at one place only, then it’s as easy as it can be to upgrade that one to a new approach. OK, using search and replace is quite effective too, but you will always have the risk of missing something!

If you find that copy and paste has been used too much in VB components, the situation is often much worse when it comes to stored procedures and ASP code. (At least for the code I’ve seen. Ehrm... And also that I’ve written a long time ago in the past.) This is out of the scope for this article, but since I got excited, I couldn’t help myself for adding this paragraph.


I promised that I would only write about my own tips and not duplicate what I’ve read from others. One thing about VB.NET that you perhaps have heard from several places is that an Integer in VB6 will be a Short in VB.NET and that a Long in VB6 will be an Integer in VB.NET. I will not say that once again.

What I will say is that I think it can be wise to change your naming conventions today if you prefix your variables to describe the datatype. I used to use int and lng as the prefix in VB6 to describe Integer and Long, but I’ve started to use sht and int instead. Since I’ve used my old prefixes for eight years or something like that, it will take some time to kill the old habit.

Skip the flaming e-mails please. I’m aware of that not everybody thinks type prefixes should be used. I like them and I will continue to use them in the future. Since I’m changing my mind quite often, I will probably skip using them after eight years or so.


Gamma, Helm, Johnson, Vlissides had their best selling book Design Patterns released in 1995. It’s still a bestseller after all those years. How come? (I guess the computer industry is one of the rare that think of five years as all those years.)

Proposals for how to design applications never goes out of fashion, right? As a matter of fact I think it will be important to be more design-centric than what is common for the average VB6 programmer today. I think that is very good since I have been nagging about that for years. (If you say something often enough, it finally becomes true, right?)

If I try to be serious for a while, I would really like to stress the tip to read Gamma’s book

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date