|
-
Aug 26th, 2005, 08:39 AM
#1
Thread Starter
Lively Member
[RESOLVED] Chr() and Asc() help
Not sure if any of this will make sense without the whole code but...
VB Code:
For a = 1 To Len(Data)
PrintText = PrintText & " " & ChrB(Asc(Right(Left(Data, 1), Len(Data) - a + 1)) + Keycode(a))
'MsgBox a
'MsgBox ChrB(Asc(Right(Left(Data, a), Len(Data) - a + 1)) + Keycode(a))
Next
'MsgBox PrintText
Basically, it gets ever letter, switches to its ascii value, adds the variable Keycode to it, then changes back into Chr()
Anywany, print text is supposed to string all the letters together, IE.
If the first letter converts to "æ"
then second letter converts to "£"
and the third letter converts to "₧"
printText should give the value "æ £ ₧"
But for some reason it ends up with "??Ü" or something similar
I have the msgbox's to check that the letters are being evaluated properly, and they are, but the PrintText is getting messed up somewhere
Edit: Added [vbcode][/vbcode] tags for clairty. - Hack
Last edited by Robert123; Aug 26th, 2005 at 09:25 AM.
-
Aug 26th, 2005, 08:53 AM
#2
Re: Chr() and Asc() help
To me it seems the entire attempt at getting the letter is wrong. You can't just use this?
VB Code:
Dim a As Long
For a = 1 To Len(Data)
PrintText = PrintText & " " & Asc(Mid$(Data, i, 1)) & Keycode(a))
Next a
..does that not do the same thing?
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Aug 26th, 2005, 09:03 AM
#3
Thread Starter
Lively Member
Re: Chr() and Asc() help
Awesome it works, thanks alot =D Didn't know about Mid()
-
Aug 26th, 2005, 09:16 AM
#4
Re: Chr() and Asc() help
np 
Remember to mark your thread as Resolved.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|