DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2006
    Posts
    82

    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
    Location
    Alameda, CA
    Posts
    1,737
    The & after a variable declares the variable a long, after a number "forces" the type of the number to be Long

    That is:
    Code:
    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
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  3. #3
    Join Date
    Aug 2005
    Posts
    51
    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

Bookmarks

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links