VB6 to .net

CADsortaGUY

Lifer
Oct 19, 2001
25,162
1
76
www.ShawCAD.com
First off, I'm not a VB programmer but can and do use small VB routines within various programs I use. I am a PLC programmer so logic and building logical routines is not a problem. However, I currently have a VB6 application that is nothing more than an interface between 3-4 different applications(matlab, graphing software, and scanner software) that "controls" a PLC. However I need to upgrade this app to .net.

1) how easy is the port over of an existing vb6 app to .net?
2) if I were to have to rewrite the code in .net - what are the recommendations for learning .net? Online classes? ...for dummies books? etc?

Like I said, I'm not a VB coder so I don't know if I'm even asking the right questions or not. So if I've said or asked something stupid - let me know so I can maybe explain what I am talking about better.

TIA!
 

brandonb

Diamond Member
Oct 17, 2006
3,731
2
0
Porting is fairly easy. But it all depends on what you are doing.

If you are using Windows API or calling old style (not even COM) DLL's there could be some problems. Also DotNet doesn't like some of the old style things such as the Variant datatype... But other than that, its fairly straight forward. If you could so some things in VB6, then it wouldn't be that big of a change going to VB.net 2005 (or greater)
 

CADsortaGUY

Lifer
Oct 19, 2001
25,162
1
76
www.ShawCAD.com
Originally posted by: brandonb
Porting is fairly easy. But it all depends on what you are doing.

If you are using Windows API or calling old style (not even COM) DLL's there could be some problems. Also DotNet doesn't like some of the old style things such as the Variant datatype... But other than that, its fairly straight forward. If you could so some things in VB6, then it wouldn't be that big of a change going to VB.net 2005 (or greater)

Yes, it uses? a couple different .dlls and such. I pretty much expected that it wouldn't port over directly and easily but I thought I'd ask.:) Now I need to teach myself .net I guess(plus get a crash course on VB6 to know what it was doing).
I should also clarify that I have only done very minor VB scripting within other applications to do a specific task or two - not something complex or even calling/using other apps.
 

WannaFly

Platinum Member
Jan 14, 2003
2,811
1
0
Visual Studio .NET 2003 will automatically try to port VB6 to .NET when you open the project, IIRC. if not, theres a menu option to do so - it works well weith basic programs, but when working with older COM/etc it has some troubles. There are some data type differences between VB6 and .NET.

It can be done - the question is why, i assume you need to modify what it does.
Theres plenty of stuff online moving from VB6 to .NET 1.0/1.1 - not sure about 2.0.
 

3NF

Golden Member
Feb 5, 2005
1,345
0
0
You'd be better off going through it line by line and rewriting it. I would never feel comfortable taking a program I didn't write and put it through some "black box" to convert it. How many lines of code is it?
 

CADsortaGUY

Lifer
Oct 19, 2001
25,162
1
76
www.ShawCAD.com
Originally posted by: 3NF
You'd be better off going through it line by line and rewriting it. I would never feel comfortable taking a program I didn't write and put it through some "black box" to convert it. How many lines of code is it?

It's not massive but it's pretty good sized. A dozen or so forms, about 20 modules and a 15 or so class modules. Some are pretty small but some are quite large. It sounds like .net 2.0 has a serialcom in the toolbox so that is a big relief. I was worried about the serial communication portion but it looks pretty simple now.
 

nakedfrog

No Lifer
Apr 3, 2001
61,356
16,900
136
I agree that you're probably best off rewriting it. A book specifically geared for VB to VB.Net would be helpful, but a course might be best.