Professional Documents
Culture Documents
Next
ClearFlag = False
End If
End Sub
Private Sub BtnSort_Click(sender As Object, e As EventArgs) Handles
BtnSort.Click
Dim i, j, k As Integer
Dim table(n), temp As Single
If ClearFlag = False Then
Exit Sub
End If
'简单选择排序
For i = 0 To n - 1
If arrTextBox(i).Text = "" Then
Exit Sub
End If
table(i) = CSng(arrTextBox(i).Text)
Next
For i = 0 To n - 2
k = i
For j = i + 1 To n - 1
If table(j) < table(k) Then
k = j
End If
Next
If k <> i Then
temp = table(k)
table(k) = table(i)
table(i) = temp
End If
Next
For i = 0 To n - 1
arrTextBox(i).Text = table(i)
Next
End Sub
Private Sub BtnClear_Click(sender As Object, e As EventArgs) Handles
BtnClear.Click
Dim i As Integer
For i = 0 To n - 1
arrTextBox(i).Text = ""
Next
End Sub
Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles
BtnExit.Click
Application.Exit()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
Dim abc As New Label
Me.Controls.AddRange(New Control() {abc})
abc.Size = New Size(100, 20)
abc.Location = New Point(100, 100)
abc.Text = "你终于来了!"
End Sub
End Class