jueves, 3 de mayo de 2012

RETO5 – Funciones Numericas



Public Class FuncionesNumericas
    Private Sub btnmostrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnmostrar.Click
        Dim numero As Double = txtnumero.Text
        Dim entero As Integer
        Dim decimalvar As Decimal
        Dim absoluto As Double
        Dim raiz As Double
        Dim signo As Integer
        entero = CInt(numero)
        txtentero.Text = entero
        decimalvar = CDec(numero)
        txtdecimal.Text = decimalvar
        absoluto = Math.Abs(numero)
        txtabsoluto.Text = absoluto
        raiz = Math.Sqrt(numero)
        txtraiz.Text = raiz
        signo = Math.Sign(numero)
        txtsigno.Text = signo
        txtoctal.Text = Oct(numero)
        txthexa.Text = Hex(numero)
    End Sub
    Private Sub Funciones_Numericas_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtnumero.Text = 0
    End Sub

    Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click
        Dim ctl As Object
        For Each ctl In Me.Controls
            If TypeOf ctl Is TextBox Then
                ctl.Text = ""
            End If
        Next
    End Sub
    Private Sub btnsalir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click
        Dim salida As Integer = MsgBox("Desea Salir?",
        MsgBoxStyle.YesNo + 32, "Mensaje al usuario")
        If salida = 6 Then
            Me.Close()
        End If
    End Sub
End Class

No hay comentarios:

Publicar un comentario