Public Class Form1
Dim arr(9) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Randomize()
TextBox1.Text = ""
For i = 0 To 9
arr(i) = 10 + Math.Floor(Rnd() * 90)
TextBox1.Text &= arr(i) & " "
Next
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i, j, temp As Integer
For i = 0 To 8
For j = i + 1 To 9
If arr(i) > arr(j) Then
temp = arr(i)
arr(i) = arr(j)
arr(j) = temp
End If
Next
Next
TextBox2.Text = ""
For i = 0 To 9
TextBox2.Text &= arr(i) & " "
Next
End Sub
End Class
Public Class Form1
Dim Num1 As Double '被+-*/数
Dim opr As String '运算符
Dim oprPressed As Boolean = False
Private Sub btnNum_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click, btn10.Click, btn11.Clickbtn
Dim btn As Button = CType(sender, Button)
If oprPressed Then
Label1.Text = btn.Text
oprPressed = False
Else
Label1.Text = CDbl(Label1.Text & btn.Text)
End If
End Sub
Private Sub btnOpr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn12.Click, btn13.Click, btn14.Click, btn15.Click
Dim btn As Button = CType(sender, Button)
opr = btn.Text
oprPressed = True
Num1 = CDbl(Label1.Text)
End Sub
Private Sub btn16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn16.Click
Select Case opr
Case "+"
Label1.Text = Num1 + CDbl(Label1.Text)
Case "-"
Label1.Text = Num1 - CDbl(Label1.Text)
Case "*"
Label1.Text = Num1 * CDbl(Label1.Text)
Case "/"
Label1.Text = Num1 / CDbl(Label1.Text)
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class