Results 1 to 5 of 5

Thread: [2005]Values at end of Constant ex( &h1) ????

  1. #1

    Thread Starter
    Lively Member smilbuta's Avatar
    Join Date
    Apr 2005
    Location
    Orlando
    Posts
    104

    [2005]Values at end of Constant ex( &h1) ????

    Im sorry to the elite coders here but i have a realy bad noob question.


    What are the refrences or values at the end of certain lines of code. I have come across an instance i need to use a constant that holds a value like this and i want to understand what it is passing or representing.
    Code:
    Public Const RESOURCETYPE_DISK As Long = &H1
    THe underlined is what i'm curious about, how does one read that??

    Thanx....
    VB.Net uber-noob since04, Yeababy!

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: [2005]Values at end of Constant ex( &h1) ????

    That represents the hex value 1, as opposed to the decimal value 1
    &h1 = 1
    &hA = 10

  3. #3

    Thread Starter
    Lively Member smilbuta's Avatar
    Join Date
    Apr 2005
    Location
    Orlando
    Posts
    104

    Re: [2005]Values at end of Constant ex( &h1) ????

    ahhh!...

    so the &H denotes that the next value is a HEX Value

    so &H1A1 would be 000110100001(bin) or 417 right?

    so in VB would &B be a binary ?? and im asuming the default is simply a decimal....
    VB.Net uber-noob since04, Yeababy!

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: [2005]Values at end of Constant ex( &h1) ????

    so &H1A1 would be 000110100001(bin) or 417 right?
    Correct

    so in VB would &B be a binary ??
    Nope, I don't believe there is syntax of this nature for binary

    and im asuming the default is simply a decimal....
    Correct

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

    Re: [2005]Values at end of Constant ex( &h1) ????

    There is no way to specify a binary literal. Standard is decimal and you can use &H and &O for hexadecimal and octal respectively. If you want to be able to specify a binary value you can only do this:
    vb.net Code:
    1. Dim int As Integer = Convert.ToInt32("10010110", 2)
    The '2' specifies to convert from base 2.
    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