RE:Convertir decimal en hexadecimal
Funcion para convertir un numero decimal a hexadecimal:
1. Te vas a File/New/PB Object/Function y declaras la siguiente función:
- Return Type: string ; Function Name: of_hex
- Argument Type: unsignedlong ; Argument Name: aul_decimal
2. Pegas lo siguiente en el cuerpo de la función:
string ls_hex=''
char lch_hex[0 to 15] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', &
'a', 'b', 'c', 'd', 'e', 'f'}
If IsNull(aul_decimal) Then
SetNull(ls_hex)
Return ls_hex
End If
Do
ls_hex = lch_hex[mod (aul_decimal, 16)] + ls_hex
aul_decimal /= 16
Loop Until aul_decimal= 0
Return ls_hex
3. Puedes usar por ejemplo, así:
st_1.Text=String(of_hex(1234))
Autor: Lijun Yang