3

I am trying to set character into a VB6 Label.

Looking at https://en.wikipedia.org/wiki/List_of_Unicode_characters

The code would be 2264 .

Label.Text = Chr(2264) generates an error Label.Text = ChrW$(2264) sets a question mark "?"

Does anyone know how to get this character

Lorenzo Belfanti
  • 1,205
  • 3
  • 25
  • 51
A.D.
  • 1,062
  • 1
  • 13
  • 37
  • 2
    VB6 supports Unicode in the sense that the strings are Unicode. Its forms are non-Unicode though and are controlled by the character set for non-Unicode programs (apparently I [have already said all that](http://stackoverflow.com/a/6552368/11683)). If the character you want is not part of the currently selected character set for non-Unicode programs, VB6 will not display it on the form unless you owner-draw everything with API calls that support Unicode (e.g. http://stackoverflow.com/q/13515686/11683). – GSerg Feb 16 '17 at 15:43
  • 3
    as a workaround, you can use &< in your caption. this will display something very similar to your desired result – nabuchodonossor Feb 16 '17 at 18:35
  • 2
    VB6 Forms are not the problem, you just have to use Unicode-aware controls on them. VB6 doesn't have a Unicode Label control, but there are plenty floating around out there as OCXs and as .CTL UserControl modules you can compile into programs. – Bob77 Feb 17 '17 at 01:14
  • I ll use the nabuchodonossor's solution with &< that nearly displays as ≤. Thx alll! – A.D. Feb 17 '17 at 08:10

2 Answers2

1
Label.Text = ChrW(&H2264) ' <-- &H for Hexadecimal

2264 is the Hexadecimal code, you can see it here.

In Decimal, it is ChrW(8804).

A.S.H
  • 29,101
  • 5
  • 23
  • 50
  • Thx for the explanation. However, both ChrW(&H2264) and ChrW(8804) are displayed as "=" into the Label :( – A.D. Feb 16 '17 at 15:17
  • I undrstand that, it worked for me in (Excel) VBA actually. For Vb6 apps to work with Unicode you should follow @GSerg 's comment. – A.S.H Feb 16 '17 at 16:12
0

The stock Symbol font contains that symbol at an ansi codepoint and so works without requiring unicode awareness, as a contrived example with 3 autosizing labels:

lbl_left.Caption = "999"

lbl_middle.Font.Name = "Symbol"
lbl_middle.Caption = ChrW$(&HA3)
lbl_middle.Left = lbl_left.Left + lbl_left.Width + Me.TextWidth(" ")

lbl_right.Caption = "1000"
lbl_right.Left = lbl_middle.Left + lbl_middle.Width + Me.TextWidth(" ")
Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Works when the "Language for non-Unicode programs" is e.g. `en-gb`. Displays `?` when "Language for non-Unicode programs" is e.g. `ru-ru`. – GSerg Feb 17 '17 at 21:48