PC Review Forums Newsgroups Microsoft DotNet Microsoft VB .NET Newbie Converting vb6 CLS file to Class File

Reply

Newbie Converting vb6 CLS file to Class File

 
Thread Tools Rate Thread
Old 26-06-2007, 01:13 AM   #1
Mo
Guest
 
Posts: n/a
Default Newbie Converting vb6 CLS file to Class File


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

  Reply With Quote
Old 26-06-2007, 02:29 AM   #2
Ray Cassick
Guest
 
Posts: n/a
Default Re: Newbie Converting vb6 CLS file to Class File

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.

"Mo" <le_mo_mo@yahoo.com> wrote in message
news:1182816819.023130.16880@p77g2000hsh.googlegroups.com...
> 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
>



  Reply With Quote
Old 26-06-2007, 12:29 PM   #3
Phill W.
Guest
 
Posts: n/a
Default Re: Newbie Converting vb6 CLS file to Class File

Mo wrote:

> 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.
  Reply With Quote
Old 26-06-2007, 04:12 PM   #4
Mo
Guest
 
Posts: n/a
Default Re: Newbie Converting vb6 CLS file to Class File

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

  Reply With Quote
Old 26-06-2007, 04:27 PM   #5
Armin Zingler
Guest
 
Posts: n/a
Default Re: Newbie Converting vb6 CLS file to Class File

"Mo" <le_mo_mo@yahoo.com> schrieb
> 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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off