Results 1 to 6 of 6

Thread: strings that aren't in Normal font

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Hi there,

    How can I assign a string to a piece of text which is something other than Normal font?

    I want to assign a string to the 'less than or equal to sign', <=, which is symbol font.

    If it was a normal character, like '<', I'd simply say:

    dim sign as string
    sign = "<"

    But to get the 'less than or equal to sign" in a picturebox you need to write:

    Form1.Picture1.Font = "symbol"
    Form1.Picture1.Print " £ ";
    Form1.Picture1.Font = "comic sans ms"

    How can I make this a string?

    I mean, you can just put:

    dim sign as string
    sign= Form1.Picture1.Font = "symbol"
    Form1.Picture1.Print " £ ";
    Form1.Picture1.Font = "comic sans ms"

    Any ideas? Is it even possible?

    Please help!

    Thanks.

  2. #2
    Guest
    Use the Chr() function to assgin a character value. For example, say that £ is Chr 16. Then you would use...
    Code:
    Dim Sign As String
    Sign = Chr(16)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Unhappy


    Megatron,

    Thanks. Can every single character, regardless of whether its font is times new roman, symbol, or whatever, be assigned a Chr()?

    Where can I find a list of all the Charcodes? I've been searching for well over an hour now, on the MS vb site and everywhere, with no luck.

    Thanks.


  4. #4
    Fanatic Member Gaffer's Avatar
    Join Date
    Nov 2000
    Location
    London
    Posts
    828
    They are set as far as I know eg i always used Chr(13) in a MsgBox to emulate the <ENTER> key.

    To get a list, create a table and populate it using recordsets based on this:

    Code:
    For i = 0 To 255
        rs.AddNew
        rs(0) = i
        rs(1) = Chr(i)
        rs.Update
    Next
    Hope this helps

  5. #5
    Guest
    0 to 32 will not be listed because they are not characters.

    Code:
    Private Sub Form_Load()
         
         For i = 33 to 255
              List1.AddItem Chr(i)
         Next
    
    End Sub
    
    Private Sub List1_DblClick()
    
         Clipboard.Clear
         Clipboard.SetText List1.text
    
    End Sub
    For more, look in your MSDN Libary (or help file) for ANSI.

    That's all you need .

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Thank you all for your help. The nearest I can get to the symbol I want, <=, is:

    Picture1.Font = "symbol"
    Picture1.Print Chr(163)

    There is no character code for it. Is it possible to assign the above to a string? I 'm sure there must be.

    For example, it's easy to assign chr(163) to a string like:

    dim sign as string
    sign= chr(163)
    Picture1.print "The man had " & sign & "100."

    ----------------

    But this doesn't work:

    dim sign as string
    sign = "symbol" And chr(163)
    Picture1.print "The man had " & sign & "100."

    Any ideas? Thanks for any help


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width