我想使用 .GetText(Col As Integer, Row As Integer, ByRef var As Object) 作为布尔方法。
但是当我使用这种方法时,总是出现运行时错误
我想给你看我的代码
With fGridview
For iCol = 1 To .MaxCols
For iRow = 1 To .MaxRows
.Col = iCol
.GetText(iCol, iRow, tmpVar)
If tmpVar = "0" Then
.SetText(iCol, iRow, "1")
End If
Next
Next
End with
如您所见,当 iCol=1,iRow=1 时,就可以了。但是当 iCol=1,iRow=2 时,出现运行时错误。我认为为什么会发生这种情况是因为 ByRef 参数。
如果我使用 tmpVar=nothing like this
.GetText(iCol, iRow, tmpVar)
If tmpVar = "0" Then
.SetText(iCol, iRow, "1")
End If
tmpVar=nothing
,效果很好。我不知道为什么会这样。当我使用 ByRef 参数时,为什么我必须在 tmpVar 中不使用任何内容。我需要你的帮助。
和类型不匹配错误
这是VB 6.0代码
With fGridview
For iCol = 1 To .MaxCols
For iRow = 1 To .MaxRows
.Col = iCol
.GetText iCol, iRow, tmpVar
If tmpVar = "0" Then
.SetText iCol, iRow, "1"
End If
Next
Next
End With
ps 我的英语不好。所以我不知道你能不能听懂我的话。无论如何,非常感谢