Results 1 to 6 of 6

Thread: Super easy string question

  1. #1

    Thread Starter
    Hyperactive Member Foxer's Avatar
    Join Date
    Oct 2001
    Location
    Australia
    Posts
    278

    Super easy string question

    I have a character

    dim x as char

    How do I determine it's ascii value so that

    x = "a"

    returns 36 (or whatever - it might be 50 something)

    In VB6, I would do

    ? asc(x)
    or
    ? char(x)

    depending but in .Net I was expecting

    ? x.ToAscii

    but char's don't support that.
    Rate my response if I helped

    Go Hard Or Go Home


  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    VB Code:
    1. Dim x As Char = "P"
    2. MessageBox.Show(Asc(x)) 'returns 80

  3. #3

    Thread Starter
    Hyperactive Member Foxer's Avatar
    Join Date
    Oct 2001
    Location
    Australia
    Posts
    278
    So it's the same?

    .Net is so inconsistent ...
    Rate my response if I helped

    Go Hard Or Go Home


  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Gary Campbell
    So it's the same?

    .Net is so inconsistent ...
    Yeah , same function . Actually , this function is imported from the compatibiliy namesapce (Miscrosoft.VisualBasic) .

  5. #5
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    Well in c# we can do (int)char and in vb.net it might be something like CType('c', integer)
    \m/\m/

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by PT Exorcist
    in vb.net it might be something like CType('c', integer)
    It won't work .

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