
正文
vb.net方法定义,vb定义类的方法
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.net 定义方法的问题
sub是可以有参数的,但是是没有返回值的。
你可以用function
如
Function add(ByVal a As Integer, ByVal b As Integer)
add = a + b
End Function
a = add(1,1) 这样a = 2
相关问答
Q1: vb.net 数组的定义方法
1、vb.net的
数组定义与变量定义差不多。可以用
dim
来定义
比如:
dim
a(100)
as
integer。
也可以不定义下标
在程序中
用
redim
来定义。
如:
dim
a()
as
integer
'
'
redim
a(100)
2、vb.net中定义数组可以直接赋值。
如:
dim
a()
as
integer
={1,
2,
3,4}
Q2: VB.NET自定义函数
很简单,在end select前再多加一种情况case else return "XXXx",因为你只提供了0-9这10种情况
Public Function Zuhe(ByVal qa As String) As String
Select Case qa
Case "0"
Return "1"
Case "1"
Return "3"
Case "2"
Return "4"
Case "3"
Return "6"
Case "4"
Return "2"
Case "5"
Return "8"
Case "6"
Return "9"
Case "7"
Return "7"
Case "8"
Return "5"
Case "9"
Return "0"
Case else
Return "XXXX"
End Select
End Function
Q3: 在vb.net中如何定义staticextern函数
在vb.net中定义staticextern函数:用static声明的局部变量。static是C++中常用的修饰符,它被用来控制变量的存贮方式和可见性。extern,C是使C++能够调用C写作的库文件的一个手段。








