Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbnewline and vbcrlf problem by converting to Hex

Status
Not open for further replies.

dabayi

Programmer
Oct 23, 2002
10
0
0
DE
HI!

I'm trying to convert a formatted string to Hex. It seems to going well. I'm getting problem with the format 'vbNewLine' and 'vbCrLf' both represented inside the string with ''. Their Ascii values are '13' and '10'. I read that this character () is not supported by Microsoft Windows.
How can I solve that problem?

'---
' Here the code
'---

Public Function AsciitoHex(ByVal str As String)
Dim Buchstabe$, x%, AsciiVal As Byte


Const Hexa = 16
x = Hexa - Len(str) Mod Hexa

' Nothing happened here. why?
str = Replace(str, "", "", 1, -1, vbTextCompare)

If x <> Hexa Then str = str & Space(x)
For x = 1 To Len(str)
Buchstabe = Mid$(str, x, 1)

'here too
If Buchstabe = &quot;&quot; Then
Buchstabe = &quot;vbcrlf&quot;
End If

If Buchstabe = Chr$(0) Then
AsciiVal = 0
Else
AsciiVal = (Asc(Buchstabe))
End If
AsciitoHex = AsciitoHex & Hex(AsciiVal)

Next

End Function

thx for helping

james



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top