You are on page 1of 2

Public Class Form1

Public Class Form1


Dim g, m, s As Double
Dim n, r As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles
Button1.Click
n = TextBox1.Text
m = 0
r = 0
g = 0
Do While m < n
m = m + 1
r = factorial(m)
s = m / r
g = g + s
'TextBox3.Text = s
textbox5.text = g
Loop
End Sub
Private Function factorial(fact As Integer)
fact = 1
For x = 1 To m
fact = fact * x
factorial = fact
Next
TextBox2.Text = factorial
End Function
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles
Button3.Click
If MsgBox(" DESEA SALIR DE LA APLICACION", vbQuestion + vbYesNo,
"pregunta") = vbYes Then
End
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles
Button2.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox5.Clear()

End Sub
End Class
End Class

You might also like