public structure struc
public name as string
public shengao as integer
......
end structure
public items as struc()
readonly property people(argname as string) as struc
get
for each i as struc in items
if i.name=argname then reture i
next
end get
end property
people也可以是类的构造方法,而shengao等是类的成员,但你的写法是错误的,构造方法必须用new实例化
Public Function Zuhe(ByVal qa As String) As String
Select Case qa
Case "0"
Return "1"
Case "1"
Return "0"
Case else
Return "XXXX"
End Select
End Function
注意:参数为动态数组;
Private Function MyF(ByRef d() As Integer)
Dim i As Integer
Dim j As Integer
Dim n As Integer
MyNum(i) = 0
Next i
Randomize
Loop
d(i, j) = n
MyNum(n) = MyNum(n) + 1
Next j
不熟悉VB,如有不妥的地方请包涵!
Public Class Stack
Dim aryData() As Integer
Sub New(ByVal Num As Integer)
Dim aryData(Num) As Integer
End Sub
Function Pop() As Integer
If (aryData.Length = 0) Then
Return 0
Else
Dim a As Integer
a = aryData(aryData.Length)
Return a
End If
Sub Push(ByVal n As Integer)
For Each i As Integer In aryData
aryData(i) = n
End
Continue For
Next
Sub PrintStack()
Print(aryData(i))
End Class
public function createstringarr() as string()
end function
首先在窗体上添加Button1,ListBox1,下面是完整代码
Public?Class?Form1
Public?Sub?BubbleSort(ByVal?arr()?As?Integer)?'冒泡法排序
Dim?temp?As?Double
Dim?i,?j?As?Integer
For?i?=?0?To?arr.GetUpperBound(0)?-?1
For?j?=?i?+?1?To?arr.GetUpperBound(0)?-?1
If?arr(i)?arr(j)?Then
temp?=?arr(j)
arr(j)?=?arr(i)
arr(i)?=?temp
End?If
End?Sub
Private?Sub?Button1_Click(ByVal?sender?As?System.Object,?ByVal?e?As?System.EventArgs)?Handles?Button1.Click?'调用
BubbleSort(arr)?'调用排序过程
Me.ListBox1.Items.Clear()
For?i?=?0?To?arr.GetUpperBound(0)?-?1?'显示排序后结果
Me.ListBox1.Items.Add(arr(i).ToString)
End?Class
以上就是土嘎嘎小编为大家整理的vb.net建立函数相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!