lunes, 18 de septiembre de 2017

Convertir de Decimal a Hexadeciaml - VB 6.0



CODIGO FUENTE 

Option Explicit

Public Function Decimal_convertir_Hexadecimal(ByVal Numero As Double) As String
    
    Dim temporal As Integer
    Dim Cadena As String
    Cadena = ""
    Do While Numero <> 0
        temporal = Numero Mod 16
        If temporal <= 9 Then
            Cadena = Chr(Asc(temporal)) & Cadena
        Else
            Cadena = Chr(Asc("A") + temporal - 10) & Cadena
        End If
        Numero = Numero \ 16
    Loop
    If Cadena = "" Then Cadena = "0"
    Decimal_convertir_Hexadecimal = Cadena
    
End Function


Private Sub Command1_Click()
    Text2.Text = Decimal_convertir_Hexadecimal(Text1.Text)
End Sub

Private Sub Command2_Click()
    Text1.Text = ""
    Text2.Text = ""
    
    Text1.SetFocus
End Sub

Private Sub Command3_Click()
    Unload Me
    End
End Sub

DESCARGAR CODIGO FUENTE