This Visual Basic code defines event handlers for three buttons on a form. Button1 divides a number entered in TextBox1 by 10 repeatedly and counts the number of whole number results, displaying the count in TextBox2. Button2 prompts the user to confirm exiting the application. Button3 clears the values in TextBox1 and TextBox2.
This Visual Basic code defines event handlers for three buttons on a form. Button1 divides a number entered in TextBox1 by 10 repeatedly and counts the number of whole number results, displaying the count in TextBox2. Button2 prompts the user to confirm exiting the application. Button3 clears the values in TextBox1 and TextBox2.
This Visual Basic code defines event handlers for three buttons on a form. Button1 divides a number entered in TextBox1 by 10 repeatedly and counts the number of whole number results, displaying the count in TextBox2. Button2 prompts the user to confirm exiting the application. Button3 clears the values in TextBox1 and TextBox2.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim n As Integer Dim x As Integer Dim c As Integer Dim d As Integer n = TextBox1.Text c=0 d=n For i = 1 To 25 x = d / 10 d=x If x >= 1 Then c=c+1 TextBox2.Text = c End If Next End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click If MsgBox("DESEA SALIR DE LA APLICACIN" + vbQuestion + vbYesNoCancel, "Pregunta") = vbYes Then End End If End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click TextBox1.Clear() TextBox2.Clear() End Sub End Class