public function createstringarr() as string()
创新互联公司致力于互联网网站建设与网站营销,提供成都网站建设、成都网站设计、网站开发、seo优化、网站排名、互联网营销、成都微信小程序、公众号商城、等建站开发,创新互联公司网站建设策划专家,为不同类型的客户提供良好的互联网应用定制解决方案,帮助客户在新的全球化互联网环境中保持优势。
return new string(){"d1","d2","d3","d4"}
end function
很简单,在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
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim a As New month(1)
MessageBox.Show(a.ToString)
End Sub
End Class
Public Class month
Dim m As Integer
Public Sub New(i As Integer)
m = i
End Sub
Public Overrides Function ToString() As String
If m = 1 And m = 12 Then
Return Choose(m, "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二") + "月"
Else
Return m.ToString
End If
End Function
End Class
注意:参数为动态数组;
Private Function MyF(ByRef d() As Integer)
ReDim d(4, 13) As Integer
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim MyNum(4) As Integer
For i = 1 To 4
MyNum(i) = 0
Next i
Randomize
For i = 1 To 4
For j = 1 To 13
n = Int(Rnd * 4 + 1)
Do While MyNum(n) = 13
n = Int(Rnd * 4 + 1)
Loop
d(i, j) = n
MyNum(n) = MyNum(n) + 1
Next j
Next i
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
Next
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '调用
Dim arr() As Integer = {55, 22, 33, 11, 77, 88}
BubbleSort(arr) '调用排序过程
Me.ListBox1.Items.Clear()
For i = 0 To arr.GetUpperBound(0) - 1 '显示排序后结果
Me.ListBox1.Items.Add(arr(i).ToString)
Next
End Sub
End Class
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款