当我定义一个初始化变量时,我得到编译时错误为"Expected:End of statement".代码是:
Dim i as integer=1
Run Code Online (Sandbox Code Playgroud)
VB6编译器不允许您在一行中声明和初始化变量(就像在VB.NET中一样).
所以你必须在一行上声明它并在另一行初始化它:
Dim i As Integer
i = 1
Run Code Online (Sandbox Code Playgroud)
如果你想在同一行上同时使用两个语句,你可以使用冒号:
Dim i As Integer : i = 1
Run Code Online (Sandbox Code Playgroud)
但是您只能在过程中执行此操作,而不能在模块,表单或类声明中执行此操作
| 归档时间: |
|
| 查看次数: |
5657 次 |
| 最近记录: |