无法这段代码从VB6转换为vb.net - SET字符串=新的应用程序

问题描述:

我有我想在我Vb.net应用程序中使用一些VB6代码,但我有一个非常困难的时期无法这段代码从VB6转换为vb.net - SET字符串=新的应用程序

这是从VB6代码....

Dim CurrentVersion as cApplication 

Set currentVerion = New Application 

,我有一个调用的函数 - 在不同的类getLatestInformation有几个paremeters看起来是这样的....

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

在我的VB6应用程序我打电话编辑它是这样的...

currentVersion.getLatestVersion 3,4,5 

我无法做任何事情,但DIM currentVersion作为CApplication。在这方面有些困难。

+0

你有什么具体问题?你有错误吗?请张贴任何可以帮助我们的线索。 – vbguyny

“Set”不再是对象分配关键字。相反,你可以做

Dim currentVersion As cApplication = New Application() 

Dim currentVersion As cApplication 
currentVersion = New Application() 

假设cApplication是一种兼容型与应用。这两种方法都会创建一个“应用程序”对象并将其分配给currentVersion变量。

你会再调用使用

currentVersion.getLatestVersion(3, 4, 5) 

VB.NET这种方式已经改变了很多语法 - 你可能想要得到一个文本,以帮助您与所有更改一起。

+1

有些东西需要更深入的调查:_cApplication_类和_Application_类之间存在什么关系? – Steve

+1

应用程序必须是一种cApplication。也就是说,应用程序从cApplication继承(这需要是一个类)或者Application实现了cApplication(它需要是一个接口)。 如果Application实际上是.NET类System.Windows.Application,那么大概用户定义的cApplication将永远不会是。 –