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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 and Unicode?

Status
Not open for further replies.

Mickey50

Technical User
Jun 11, 2013
2
SE
Is it possible to make the TextBox control in VB6 to handle Unicode characters? I want the user to be able to enter Unicode characters (for example text in Russian or Chinese language) and then save the text in a text file (in the Unicode format).

What is the best method to achieve this? Or is it even possible?

This is a piece of cake in VB.NET, but i have a legacy VB6 program to maintain, and need to add Unicode support to it.
 
You could use Forms 2.0 controls. These should be able to handle Unicode. They are however part of Office, hence must not be distributed. The user must have Office installed for this to work.


“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
The textbox does not support Unicode.

The RichTextBox does (but hides this fact extremely well - so well, in fact, that given VB6's own generally Unicode-hostile configuration, it is pretty much impossible to get VB6 itself to insert or extract Unicode characters into or from it.

Of course, VB can correctly display foreign characters pretty well using codepage mapping without resorting to Unicode controls (here's a Microsoft example on the subject)

An alternative is to use the Unicode-aware controls from the Forms 2.0 library included with office. Technically this is not redistributable, but you can get them (if you don't have Office) by downloading the free ActiveX Control Pad from Microsoft. I am not aware that any of the controls directly support the ability to save in Unicode; you'd have to code this yourself.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top