Results 1 to 2 of 2

Thread: Strange with integer!

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2004
    Location
    in the heart of the Mediterranean
    Posts
    1,143

    Strange with integer!

    HI,

    I have this userID that is used in a login form. It is returning and &H + integer. Strange as it was working fine . I dont have the slightest idea why.

    Code:
    Public userID as integer
    
                    bCheck = True 'indicates access permitted
                     userID = CInt(Trim(cmd.Parameters("@userID").Value))   ' (userID = &H3
                    MessageBox.Show(userID.ToString)  ' ( userID = 3)
    --------------------------------------------

    Then if I try
    Code:
    bCheck = True 'indicates access permitted
          (SuserID=3)  SuserID = CStr(cmd.Parameters("@userID").Value)
     (userID=&H3)  userID = CInt(SuserID)
                    MessageBox.Show(SuserID)
    Anyone knows what's the problem pls?
    Last edited by angelica; Sep 11th, 2008 at 11:47 PM.
    ------------------------------------------------------------------------
    If an answer to your question has been helpful, then please, Rate it!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Strange with integer!

    There is no problem. That's merely a hexadecimal representation of a number. The number itself doesn't contain the '&H' part. That's just a format to tell you that you're reading hexadecimal and not decimal.

    1 = &H1
    2 = &H2
    3 = &H3
    4 = &H4
    5 = &H5
    6 = &H6
    7 = &H7
    8 = &H8
    9 = &H9
    10 = &HA
    11 = &HB
    12 = &HC
    13 = &HD
    14 = &HE
    15 = &HF
    16 = &H10
    17 = &H11
    18 = &H12
    etc.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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