View Code
1 Public Class Form1 2 3 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 4 Dim number As Integer = 0 5 Dim Check As Boolean = True 6 Dim Value1 As Integer = 1 7 Dim Value2 As Integer = 0 8 9 Do 10 Do While number >= 0 11 number += 1 12 Value1 *= number 13 14 If Value1 >= 4000 Then 15 TextBox1.Text = number 16 17 Do 18 Value2 += number ^ 2 19 number -= 1 20 Loop Until number = 0 21 22 TextBox2.Text = Value2 23 Check = False 24 25 Exit Do 26 End If 27 Loop 28 Loop Until (Check = False) 29 30 End Sub 31 32 Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 33 TextBox1.Clear() 34 TextBox2.Clear() 35 End Sub 36 End Class