Results 1 to 15 of 15

Thread: Wierd Function arguments - % and $ [RESOLVED]

  1. #1

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Wierd Function arguments - % and $ [RESOLVED]

    Hi, what is up with those special characters?

    VB Code:
    1. Public Function OpenLab(ByVal LabFile$) As Boolean

    and

    VB Code:
    1. Public Function PrintLab(ByVal Num%) As Boolean

    What do they do?
    Last edited by Dave Sell; Aug 4th, 2004 at 04:00 PM.

  2. #2
    Frenzied Member Jmacp's Avatar
    Join Date
    Jul 2003
    Location
    UK
    Posts
    1,959
    Its old VB for declaring the var type.

    $ = string
    % = int

  3. #3
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734
    Has something to do with data types, I don't remember what symbols go with which data types though =/

    Edit
    Listen to the above =)
    Didn't see his post when I sent mine.

    Edit 2
    Wow, now listen to the undersigned as well =)

  4. #4
    Hyperactive Member
    Join Date
    Nov 2003
    Location
    In Front of my computer...
    Posts
    367
    THey are data types....

    DIm Boo$
    Dim Boo%
    Dim Boo&

    $ = string
    % = integer
    & = Long

    VB Code:
    1. Public Function OpenLab(ByVal LabFile as string) As Boolean 'Public Function OpenLab(ByVal LabFile$) As Boolean
    2. Public Function PrintLab(ByVal Num as integer) As Boolean 'Public Function PrintLab(ByVal Num%) As Boolean
    Born to help others
    (If I've been helpful then please rate my post. Thanks)

    call me EJ or be slapped!

  5. #5

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    OK I kinda figured it was something like that. I used to program in QBASIC and numerals were suffixed in '#' and strings were suffixed in '$'.

    Thanks all!

  6. #6
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    for the record your fellow programmers will shoot you if you use them now

  7. #7

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    I wonder If I can get away with a global search and replace:

    Replace "$"
    With "As String"

  8. #8
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    The replace might not be a good idea, what about the mid$ function, than would look : mid as string (str1,2,5).....
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  9. #9
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Code:
    $ = String
    % = Integer
    & = Long
    ! = Single
    # = Double
    Only the extra 2

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    no a global search and replace would be a BAD idea

    You can reference the strings like this
    VB Code:
    1. Dim MyString$
    2. MyString$ = "HELLO WORLD"
    which after your replace would look like
    VB Code:
    1. Dim MyString As String
    2. MyString As String = "GOODBYE WORLD"

  11. #11

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    In the code, the suffixes were not used. Only on the Dim... line or in the argument line.

  12. #12
    Fanatic Member
    Join Date
    Dec 2002
    Location
    North Carolina
    Posts
    734
    Originally posted by kleinma
    no a global search and replace would be a BAD idea

    You can reference the strings like this
    VB Code:
    1. Dim MyString$
    2. MyString$ = "HELLO WORLD"
    which after your replace would look like
    VB Code:
    1. Dim MyString As String
    2. MyString As String = "GOODBYE WORLD"
    After his replace wouldn't it look like this:

    VB Code:
    1. Dim MyString As String
    2. MyString As String = "HELLO WORLD"


  13. #13
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by dsheller
    After his replace wouldn't it look like this:

    VB Code:
    1. Dim MyString As String
    2. MyString As String = "HELLO WORLD"

    yup except it would be "goodbye" cause the code wouldnt compile

  14. #14

    Thread Starter
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    VB Code:
    1. Dim MyString As String
    2. MyString As String = "GOODBYE WORLD"
    Then it should be:

    VB Code:
    1. Dim MyString As String
    2. MyString As String = "GOODBYE CRUEL WORLD"

  15. #15
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    Originally posted by Dave Sell
    Then it should be:

    VB Code:
    1. Dim MyString As String
    2. MyString As String = "GOODBYE CRUEL WORLD"
    speaking of cruel, i have to convert a QBasic program myself and there about 200 variables, all declared at a global level, and they are all 1 or 2 digit names

    Dim a1$
    Dim a2$
    etc....

    oooo that is going to be fun

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