Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. Public Class Sort
  2. Dim a As Integer
  3. Dim b As Integer
  4. Dim c As Integer
  5.  
  6. Private Sub Sort_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.  
  8. End Sub
  9.  
  10. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  11. Randomize()
  12. txtNum1.Text = CInt(Rnd() * 10)
  13. txtNum2.Text = CInt(Rnd() * 10)
  14. txtNum3.Text = CInt(Rnd() * 10)
  15. txtNum4.Text = CInt(Rnd() * 10)
  16. txtNum5.Text = CInt(Rnd() * 10)
  17. txtNum6.Text = CInt(Rnd() * 10)
  18. txtNum7.Text = CInt(Rnd() * 10)
  19. txtNum8.Text = CInt(Rnd() * 10)
  20. txtNum9.Text = CInt(Rnd() * 10)
  21. txtNum10.Text = CInt(Rnd() * 10)
  22.  
  23. End Sub
  24.  
  25. Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submit.Click
  26. c = 1
  27.  
  28. Do Until c = 30
  29.  
  30.  
  31. If txtNum1.Text = 10 Then
  32. a = txtNum1.Text
  33. b = txtNum2.Text
  34. txtNum1.Text = b
  35. txtNum2.Text = a
  36. ElseIf (txtNum2.Text = 10) Then
  37.  
  38. ElseIf txtNum1.Text > txtNum2.Text Then
  39. a = txtNum1.Text
  40. b = txtNum2.Text
  41. txtNum1.Text = b
  42. txtNum2.Text = a
  43. End If
  44. If txtNum2.Text = 10 Then
  45. a = txtNum2.Text
  46. b = txtNum3.Text
  47. txtNum2.Text = b
  48. txtNum3.Text = a
  49. ElseIf (txtNum3.Text = 10) Then
  50.  
  51. ElseIf txtNum2.Text > txtNum3.Text Then
  52. a = txtNum2.Text
  53. b = txtNum3.Text
  54. txtNum2.Text = b
  55. txtNum3.Text = a
  56. End If
  57. c = c + 1
  58. If txtNum3.Text = 10 Then
  59. a = txtNum3.Text
  60. b = txtNum4.Text
  61. txtNum3.Text = b
  62. txtNum4.Text = a
  63. ElseIf (txtNum4.Text = 10) Then
  64.  
  65. ElseIf txtNum3.Text > txtNum4.Text Then
  66. a = txtNum3.Text
  67. b = txtNum4.Text
  68. txtNum3.Text = b
  69. txtNum4.Text = a
  70. End If
  71. If txtNum4.Text = 10 Then
  72. a = txtNum4.Text
  73. b = txtNum5.Text
  74. txtNum4.Text = b
  75. txtNum5.Text = a
  76. ElseIf (txtNum5.Text = 10) Then
  77.  
  78. ElseIf txtNum4.Text > txtNum5.Text Then
  79. a = txtNum4.Text
  80. b = txtNum5.Text
  81. txtNum4.Text = b
  82. txtNum5.Text = a
  83. End If
  84. If txtNum5.Text = 10 Then
  85. a = txtNum5.Text
  86. b = txtNum6.Text
  87. txtNum5.Text = b
  88. txtNum6.Text = a
  89. ElseIf (txtNum6.Text = 10) Then
  90.  
  91. ElseIf txtNum5.Text > txtNum6.Text Then
  92. a = txtNum5.Text
  93. b = txtNum6.Text
  94. txtNum5.Text = b
  95. txtNum6.Text = a
  96. End If
  97. If txtNum6.Text = 10 Then
  98. a = txtNum6.Text
  99. b = txtNum7.Text
  100. txtNum6.Text = b
  101. txtNum7.Text = a
  102. ElseIf (txtNum7.Text = 10) Then
  103.  
  104. ElseIf txtNum6.Text > txtNum7.Text Then
  105. a = txtNum6.Text
  106. b = txtNum7.Text
  107. txtNum6.Text = b
  108. txtNum7.Text = a
  109. End If
  110. If txtNum7.Text = 10 Then
  111. a = txtNum7.Text
  112. b = txtNum8.Text
  113. txtNum7.Text = b
  114. txtNum8.Text = a
  115. ElseIf (txtNum8.Text = 10) Then
  116.  
  117. ElseIf txtNum7.Text > txtNum8.Text Then
  118. a = txtNum7.Text
  119. b = txtNum8.Text
  120. txtNum7.Text = b
  121. txtNum8.Text = a
  122. End If
  123. If txtNum8.Text = 10 Then
  124. a = txtNum8.Text
  125. b = txtNum9.Text
  126. txtNum8.Text = b
  127. txtNum9.Text = a
  128. ElseIf (txtNum9.Text = 10) Then
  129.  
  130. ElseIf txtNum8.Text > txtNum9.Text Then
  131. a = txtNum8.Text
  132. b = txtNum9.Text
  133. txtNum8.Text = b
  134. txtNum9.Text = a
  135. End If
  136. If txtNum9.Text = 10 Then
  137. a = txtNum9.Text
  138. b = txtNum10.Text
  139. txtNum9.Text = b
  140. txtNum10.Text = a
  141. ElseIf (txtNum10.Text = 10) Then
  142.  
  143. ElseIf txtNum9.Text > txtNum10.Text Then
  144. a = txtNum9.Text
  145. b = txtNum10.Text
  146. txtNum9.Text = b
  147. txtNum10.Text = a
  148. End If
  149. Loop
  150. End Sub
  151. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement