sap xep so

Private Sub cmdgiam_Click()

Dim a(1 To 8) As Integer

Dim i, j, t As Integer

Dim s As String

a(1) = Int(txt1)

a(2) = Int(txt2)

a(3) = Int(txt3)

a(4) = Int(txt4)

a(5) = Int(txt5)

a(6) = Int(txt6)

a(7) = Int(txt7)

a(8) = Int(txt8)

s = ""

For i = 1 To 8

For j = i + 1 To 8

If (a(i) < a(j)) Then

t = a(i)

a(i) = a(j)

a(j) = t

End If

Next j

s = s & a(i)

Next i

txt1 = Left(s, 1)

txt2 = Mid(s, 2, 1)

txt3 = Mid(s, 3, 1)

txt4 = Mid(s, 4, 1)

txt5 = Mid(s, 5, 1)

txt6 = Mid(s, 6, 1)

txt7 = Mid(s, 7, 1)

txt8 = Mid(s, 8, 1)

End Sub

Private Sub cmdload_Click()

txt1.Text = Left(txtso, 1)

txt2.Text = Mid(txtso, 2, 1)

txt3.Text = Mid(txtso, 3, 1)

txt4.Text = Mid(txtso, 4, 1)

txt5.Text = Mid(txtso, 5, 1)

txt6.Text = Mid(txtso, 6, 1)

txt7.Text = Mid(txtso, 7, 1)

txt8.Text = Mid(txtso, 8, 1)

End Sub

Private Sub cmdtang_Click()

Dim a(1 To 8) As Integer

Dim i, j, t As Integer

Dim s As String

a(1) = Val(txt1)

a(2) = Val(txt2)

a(3) = Val(txt3)

a(4) = Val(txt4)

a(5) = Val(txt5)

a(6) = Val(txt6)

a(7) = Val(txt7)

a(8) = Val(txt8)

s = ""

For i = 1 To 8

For j = i + 1 To 8

If (a(i) > a(j)) Then

t = a(i)

a(i) = a(j)

a(j) = t

End If

Next j

s = s & a(i)

Next i

txt1 = Left(s, 1)

txt2 = Mid(s, 2, 1)

txt3 = Mid(s, 3, 1)

txt4 = Mid(s, 4, 1)

txt5 = Mid(s, 5, 1)

txt6 = Mid(s, 6, 1)

txt7 = Mid(s, 7, 1)

txt8 = Mid(s, 8, 1)

End Sub

Private Sub cmdtieptuc_Click()

txtso = ""

txt1 = ""

txt2 = ""

txt3 = ""

txt4 = ""

txt5 = ""

txt6 = ""

txt7 = ""

txt8 = ""

txt9 = ""

txt10 = ""

txtso.SetFocus

End Sub

Private Sub cmdthoat_Click()

Dim x As String

x = MsgBox("Ban muon thoat?", vbOKCancel + vbQuestion + vbDefaultButton1, "Thong bao!")

If x = vbOK Then

End

End If

End Sub

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: