Programa que calcula la raiz de cualquier numero
Public Class Form23
Private Sub Calcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calcular.Click
'REM Declarar todas las variables
Dim num, indice As Integer
Dim raiz As Double
'REM Validar a los objetos de entrada
If Me.onum.Text = "" Then
MsgBox("digite el numero ")
Me.onum.Focus()
Else
If Me.oindice.Text = "" Then
MsgBox("digite el indice ")
Me.oindice.Focus()
Else
End If
'REM Asignar los valores a los objetos de netrada
num = Me.onum.Text
indice = Me.oindice.Text
If indice = 0 Then
MsgBox("el indice puede ser 0")
Me.oindice.Text = ""
Exit Sub
End If
'REM Proceso
raiz = num ^ (1 / indice)
'Asignar la respuesta al objeto de salida
Me.Label5.Text = raiz
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.onum.Text = ""
Me.oindice.Text = ""
Me.Label5.Text = ""
Me.onum.Focus()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
'Para salir se utiliza la funcion
If (MsgBox("Esta seguro que desea salir?", MsgBoxStyle.YesNo, "Advertencia")) = MsgBoxResult.Yes Then
MsgBox("Gracias")
Close()
End If
End Sub
End Class
Comentarios
Publicar un comentario