whats & means in VB??

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: whats & means in VB??

  1. #1
    Join Date
    Jan 2006

    whats & means in VB??

    Hi Guys,

    I have a question here...it may be simple to some but is bothering me...

    whats the function of & in VB? some times I see assignment statements like x& = .....

    In graphics programming, whenever we need to get the RGB value, we use &H100& and &H10000<---for this case, how come there is no & at the end of the hexa, just like &H100&?? In RGB case, &H i believe it means Hexa right? what about binary?

    Thanks alot for your time guys...

  2. #2
    Join Date
    Nov 2003
    Alameda, CA
    The & after a variable declares the variable a long, after a number "forces" the type of the number to be Long

    That is:
    dim i&          ''is the equivalent of "dim i as long"
    i = &hFFFF    '' &hFFFF is a short (because the default is Integer), so i = -1
    i = &hFFFF&  '' &hFFFF& is a long, so i = 65535
    "There are two ways to write error-free programs. Only the third one works."

  3. #3
    Join Date
    Aug 2005
    The '&' character is also used to concatenate things in VB.

    For example:

    Dim a As String
    Dim b As String

    a = "This is "
    b = "an example."

    Label1.Caption = a & b

    The caption on the label would be: This is an example.

Similar Threads

  1. re: moving from VB to C# -- more reasons
    By Jeff Johnson in forum .NET
    Replies: 6
    Last Post: 01-18-2007, 07:44 AM
  2. .NET vs. Enterprise Java: Who's Got Better Security?
    By Glen Kunene in forum Talk to the Editors
    Replies: 17
    Last Post: 03-23-2002, 12:43 AM
  3. Replies: 90
    Last Post: 04-17-2001, 12:45 AM
  4. VB 6 does not get error from RAISERROR in SQL stored procdure
    By Allison Boughton in forum VB Classic
    Replies: 6
    Last Post: 03-05-2001, 12:27 PM
  5. VB Tips & Tricks E-News
    By David McCarter in forum vb.announcements
    Replies: 0
    Last Post: 07-24-2000, 12:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center