一段代码编译出错,请大家帮忙,我是VB.Net 初学者
Sub testFun(ByVal x As Integer, ByRef y As Integer, ByRef z As Integer)
x += 1
y += 1
z = 5
End Sub
调用部分:
Dim a = 1, b = 1, c As Integer
testFun(a, b, c)
Console.WriteLine( "{0} {1} {2} ", a, b, c)
[解决办法]
testFun(a, b, c)
是类的一个方法
应该先声明类的实例
class x=new clas()
x.testFun(a, b, c)
*****************************************************************************
欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码)
http://www.cnblogs.com/feiyun0112/archive/2006/09/20/509783.html
[解决办法]
我觉得楼主没有写错吧,方法需要实例化吗,类才需要实例化
Module Module1
Sub main()
Dim a = 1, b = 1, c As Integer
testFun(a, b, c)
Console.WriteLine( "{0} {1} {2} ", a, b, c)
End Sub
Sub testFun(ByVal x As Integer, ByRef y As Integer, ByRef z As Integer)
x += 1
y += 1
z = 5
End Sub
End Module
[解决办法]
Dim a = 1, b = 1, c As Integer
testFun(a, b, c)
Console.WriteLine( "{0} {1} {2} ", a, b, c)
后面再添加一句
Console.ReadLine()