what does the & represent here?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • notregister

    what does the & represent here?

    Selected& = Device_Display. ListIndex

    sometime i do see $ replacing the &, what does it mean also?
  • David Anton

    #2
    RE: what does the & represent here?

    These are the notorious "ancient type specifiers".
    Sometime way, way back in the history of the Basic language someone decided
    that it would be nice to allow declaring variables with merely a single
    character at the end of the name to signify the type of the variable.

    e.g.,
    Dim SomeString$ 'instead of Dim SomeString As String
    Dim SomeLong& 'instead of Dim SomeLong As Long
    (there are a handful of others to cover the basic types that existed in
    early versions of VB).

    In code, you could then refer to "SomeString $" or "SomeString " - both refer
    to the variable declared as SomeString$.

    And strangely enough, VB.NET *still* allows this archaic usage.

    David Anton
    Tangible Software Solutions
    Source code converters: Convert between C#, C++, Java, and VB with the most accurate and reliable source code converters

    Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
    VB.NET converter


    "notregiste r" wrote:
    [color=blue]
    > Selected& = Device_Display. ListIndex
    >
    > sometime i do see $ replacing the &, what does it mean also?[/color]

    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: what does the & represent here?

      David,

      "David Anton" <DavidAnton@dis cussions.micros oft.com> schrieb:[color=blue]
      > In code, you could then refer to "SomeString $" or "SomeString " - both
      > refer
      > to the variable declared as SomeString$.
      >
      > And strangely enough, VB.NET *still* allows this archaic usage.[/color]

      That's one of the rare cases where VB.NET is compatible with VB Classic :-).

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

      Comment

      • Jay B. Harlow [MVP - Outlook]

        #4
        Re: what does the &amp; represent here?

        David,
        Actually early versions Basic only supported variables with a single
        character optionally followed by the type character or a single character
        followed by a digit optionally followed by the type character.

        So as your variables you could only use:
        a$
        l&
        A1
        A2$

        Its been too long, I don't think that "Dim" was even a keyword, I know "Dim"
        was in QBasic (Quick Basic), however I don't remember it in GWBasic...

        I mean early versions, such as Cassette Basic that was included in ROM on
        the original IBM PC. Remember Basic was "old" when Cassette Basic came out!

        Here's an Extended Cassette Basic manual:



        Hope this helps
        Jay

        "David Anton" <DavidAnton@dis cussions.micros oft.com> wrote in message
        news:EA974D21-4A41-4D30-A4EA-9F39C4F2CA7E@mi crosoft.com...[color=blue]
        > These are the notorious "ancient type specifiers".
        > Sometime way, way back in the history of the Basic language someone
        > decided
        > that it would be nice to allow declaring variables with merely a single
        > character at the end of the name to signify the type of the variable.
        >
        > e.g.,
        > Dim SomeString$ 'instead of Dim SomeString As String
        > Dim SomeLong& 'instead of Dim SomeLong As Long
        > (there are a handful of others to cover the basic types that existed in
        > early versions of VB).
        >
        > In code, you could then refer to "SomeString $" or "SomeString " - both
        > refer
        > to the variable declared as SomeString$.
        >
        > And strangely enough, VB.NET *still* allows this archaic usage.
        >
        > David Anton
        > Tangible Software Solutions
        > www.tangiblesoftwaresolutions.com
        > Home of the Instant C# VB.NET to C# converter and the Instant VB C# to
        > VB.NET converter
        >
        >
        > "notregiste r" wrote:
        >[color=green]
        >> Selected& = Device_Display. ListIndex
        >>
        >> sometime i do see $ replacing the &, what does it mean also?[/color][/color]


        Comment

        Working...