Bobski Bobski - 9 months ago 43 Question

not able to convert this code from vb6 to - SET string = New Application

I have some vb6 code that I'm trying to use in my application but am having an extremely difficult time

this is code from VB6....

Dim CurrentVersion as cApplication

Set currentVerion = New Application

and I have a function called - getLatestInformation in a different class with a few paremeters looks like this....

GetLatestVersion(VaID As Integer, VaMode As Integer, ValueID As Integer)

IN my vb6 application i called it like this...

currentVersion.getLatestVersion 3,4,5

I am unable to do anything but DIM currentVersion as CApplication. Having some hard time with this.

Answer Source

"Set" is no longer an object assignment keyword. Instead you can do

Dim currentVersion As cApplication = New Application()


Dim currentVersion As cApplication
currentVersion = New Application()

assuming cApplication is a compatible type with Application. Both ways create an "Application" object and assign it to the currentVersion variable.

You would then call using

currentVersion.getLatestVersion(3, 4, 5)

VB.NET has changed a lot of syntax in this way--you may want to get a text to help you along with all the changes.