Newbie Converting vb6 CLS file to Class File

M

Mo

Hi,

I have an onld VB6 DLL with many classes defined in *.cls files. I
like to convert them to VB.Net. I have a couple of questions
1) Get/Set is not supported in VB.Net how do I convert this code so
VB.Net does not come up with error

Class MyAppClass

Public Property Get UserId() As Long
UserId = intUserId
End Property

Public Property Let UserId(ByVal pUserId As Long)
intUserId = pUserId
End Property

End Class

2) Can I use the "cls" file extension or should I change it to "VB"
extension
3)Is there a VB6 to VB.Net translator?

Thanks
 
R

Ray Cassick

Have you tried opening the VB6 project file in VB.NET yet?

There is a conversion wizzard that should do the basics to bring it over.
 
P

Phill W.

Mo said:
1) Get/Set is not supported in VB.Net how do I convert this code so
VB.Net does not come up with error

Public Property UserId() As Integer
Get
Return intUserId
End Get
Set( Value as Integer )
intUserId = Value
End Set
End Property

Well done, BTW, for spotting the change from Long to Integer.
2) Can I use the "cls" file extension or should I change it to "VB"
extension

Change it to .vb, otherwise the IDE won't recognise it and will probably
try to upgrade what it /thinks/ is VB "Proper" code into VB.Net, but
it's already VB.Net code, so it'll get into an even /bigger/ muddle than
usual.
3)Is there a VB6 to VB.Net translator?

Yes, the VB IDE.
Just open the .cls file and it will /try/ to upgrade it. IMHO, it
doesn't make a very good job of it and, even if it does manage to
produce something that compiles, the code it produces is unlikely to be
anything like the code you'd write from scratch.

HTH,
Phill W.
 
M

Mo

Thank you Phil, Just the information I needed. One more question I
have. I have whole bunch of *.cls class files and one xxx.bas file.
How do I create a new VB6 project to create a dll file from these
files called mydll.dll? Any pointer on how to go about it? I inherited
this old application and I am not sure how to recreate the original
solution.

Thanks
 
A

Armin Zingler

Mo said:
Thank you Phil, Just the information I needed. One more question I
have. I have whole bunch of *.cls class files and one xxx.bas file.
How do I create a new VB6 project to create a dll file from these
files called mydll.dll? Any pointer on how to go about it? I
inherited this old application and I am not sure how to recreate the
original solution.


The classes must have been part of a VB6 project. If you don't have a
running and compilable VB6 project, it's hard or even impossible for the
VB.Net upgrade wizard to migrate the project. So, don't you have a VB6
project (.vbp file)?


Armin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top