Results 1 to 5 of 5

Thread: [RESOLVED] Variable Name Decalration with []

  1. #1

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Resolved [RESOLVED] Variable Name Decalration with []

    In this

    Dim [end] As Point = e.Location

    what is the significance of the [] 's?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Variable Name Decalration with []

    same as it is in SQL... prevents the variable end from being confused with the keyword End. Personally I think it's a poor choice for a variable name, but hey, what ever works.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Variable Name Decalration with []

    It was just something I came across, and the choice of the name was fitting (it was the end of a line). Thanks!
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: [RESOLVED] Variable Name Decalration with []

    tg, why would you use it in this scenario?

    vb Code:
    1. for each... in [enum].getvalues

  5. #5
    Fanatic Member
    Join Date
    Jan 2006
    Posts
    710

    Re: [RESOLVED] Variable Name Decalration with []

    'Enum' is a reserved word in VB, so to specify the System.Enum class, you either have to fully qualify it or use [Enum]. The VS IDE will normally do this for you automatically.

    (the same is true of System.Delegate, System.Reflection.Assembly, and System.Reflection.Module - if you don't fully qualify the type, you'll need the square brackets).
    David Anton
    Convert between VB, C#, C++, & Java
    www.tangiblesoftwaresolutions.com

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