无法将此代码从 vb6 转换为 vb.net - SET string = New Application

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

我有一些 vb6 代码,我想在我的 Vb.net 应用程序中使用,但我遇到了非常困难的一段时间

这是来自 VB6 的代码....

Dim CurrentVersion as cApplication

Set currentVerion = New Application

我在另一个 class 中有一个名为 getLatestInformation 的函数,其中一些参数看起来像这样....

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

在我的 vb6 应用程序中,我这样称呼它...

currentVersion.getLatestVersion 3,4,5

除了 DIM currentVersion 作为 CApplication,我什么也做不了。遇到一些困难。

"Set" 不再是对象赋值关键字。相反你可以做

Dim currentVersion As cApplication = New Application()

Dim currentVersion As cApplication
currentVersion = New Application()

假设 cApplication 是与 Application 兼容的类型。两种方式都创建一个 "Application" 对象并将其分配给 currentVersion 变量。

然后您将调用使用

currentVersion.getLatestVersion(3, 4, 5)

VB.NET 以这种方式更改了很多语法——您可能希望获得文本来帮助您完成所有更改。