-
Closed: Using Unicode
Can one use unicode in a visual basic application to input Latin-Extended characters in a text box? Specific characters include A with a macron above it, which is unicode 0101. I can do ascii up to 255, but the latter characters that I need I don't know how to insert because they are unicode....please help
-
I'm sure there must be an easier way but VB actually stores strings in memory as unicode so you can create a unocode string from a byte array using this function:
[vba]
Function UnicodeChar(code As Long) As String
Dim b(0 To 1) As Byte
b(0) = code \ 100
b(1) = code - b(0) * 100
UnicodeChar = b
End Function
[/vba]
"Computers are useless. They can only give you answers." - Pablo Picasso
Mark Rowlinson FIA |
The Code Net
-
Use ChrW instead of Chr:[vba]ME.Textbox1.Text = ChrW(&H101)[/vba]
-
Good spot Helen. I knew there must be a built in fucntion but I couldn't remember it off the top of my head! It was quicker to write out a new one!
"Computers are useless. They can only give you answers." - Pablo Picasso
Mark Rowlinson FIA |
The Code Net
-
If you're going to stack a textbox with a string, you might as well spare yourself the overhead and use the string variety of the chrw function eh.
E.g., ChrW$(257)
-
Example
Attached is an Example.
-
-
Using Unicode to insert a macron A (Latin Extended A) into a textbox....by way of Com
NO, Dreamboat...it didn't help. I found out that VB doesn't recognize Unicode directly in the textboxes....
-
Try a richtextbox.
"Computers are useless. They can only give you answers." - Pablo Picasso
Mark Rowlinson FIA |
The Code Net
-
You can delete the thread
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