Results 1 to 5 of 5

Thread: Using const (hex value) .[Resolved]

  1. #1

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Using const (hex value) .[Resolved]

    How can I declare this in C# ?
    Code:
    private const LB_FINDSTRING = &H18F;
    . It gives error says : "Identifier expected" (under equal sign !)
    Last edited by Pirate; Jun 19th, 2003 at 07:22 PM.

  2. #2
    New Member
    Join Date
    Jun 2003
    Location
    San Diego, CA
    Posts
    1
    your need to say:

    private const int LB_FINDSTRING = [HEXADECIMAL];

    Of course [HEXADECIMAL] being the hexadecimal you are going to use to set the variable

  3. #3
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    the hex prefix in C# is 0x, not &H like VB.
    Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    Code:
    public const int LB_FINDSTRING = 0x18F;
    you can convert any vb const by replacing the &H with 0x

    here's 3 random examples i run in a C# form and there vb formats :
    Code:
    public const int PBM_SETBKCOLOR = 0x2001;
    public const int PBM_SETBARCOLOR = 0x409;
    public const int WM_CLOSE = 0x10;
    '/// C# / C++ use this format 0x
    '///
    Private Const PBM_SETBKCOLOR As Long = &H2001
    Private Const PBM_SETBARCOLOR As Long = &H409
    Private Const WM_CLOSE As Long = &H10
    '/// these are the vb versions.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5

    Thread Starter
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Thanks for the little rule guys , worked perfect .

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