Conversion hexadecimal

Résolu
cs_Kernox Messages postés 34 Date d'inscription samedi 5 avril 2003 Statut Membre Dernière intervention 10 juillet 2005 - 21 juil. 2003 à 10:08
mightykay Messages postés 10 Date d'inscription dimanche 29 décembre 2002 Statut Membre Dernière intervention 17 mai 2004 - 14 oct. 2003 à 21:39
Bon voila j'ai besoin de convertir un texte entier de plus de 9999 ligne en hexadecimal dans un control RichTextBox

J'ai essayé avec un controle Text mais c'est trop petit pour autant de caracteres

La conversion doit aussi apparaitre dans un RichTextBox et non une grille.

J'attend vos suggestion
Merci d'avance
<Kernox > :)

1 réponse

mightykay Messages postés 10 Date d'inscription dimanche 29 décembre 2002 Statut Membre Dernière intervention 17 mai 2004
14 oct. 2003 à 21:39
Function HexCrypt2(ByRef Text As String) As String
Dim Size As Long
Dim Buffer As String
Dim Car As Byte
Dim i As Long

Size = Len(Text)
Buffer = Space$(2 * Size)

For i = 1 To Size
Car = Asc(Mid$(Text, i, 1))
If Car < 16 Then
Mid$(Buffer, (i * 2) - 1, 2) = "0" & Hex$(Car)
Else
Mid$(Buffer, (i * 2) - 1, 2) = Hex$(Car)
End If
Next i
HexCrypt2 = Buffer
End Function

'--------------------------------
dim string1 as string
RichTextBox1 = HexCrypt2(String1)
3
Rejoignez-nous