SoloCodigo

Programación General => Visual Basic 6.0 e inferiores => Mensaje iniciado por: maxstepin en Viernes 16 de Julio de 2010, 22:56

Título: Convertir hexadecimal en Decimal.
Publicado por: maxstepin en Viernes 16 de Julio de 2010, 22:56
hola

teniendo este codigo:

Código: Visual Basic
  1. Function HexToLong(ByVal sHex As String) As Long
  2.         HexToLong = Val("&H" & sHex & "&")
  3.       End Function
  4.  
  5. Private Sub txtDecimal_Change()
  6.     txtHexadecimal.Text = Hex(CLng(txtDecimal.Text))
  7.  
  8. End Sub
  9.  
  10. Private Sub txtHexadecimal_Change()
  11.     'txtDecimal.Text = CLng("&h" & txtHexadecimal.Text)
  12.    'Val
  13.    txtDecimal.Text = HexToLong(txtHexadecimal.Text)
  14.  

Porque no me funciona la linea 'txtDecimal.Text = CLng("&h" & txtHexadecimal.Text) sin tener que invocar a la funcion?
Finaliza con error cunado excedo en digitos tanto en un texbox como el otro.

salud