Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Meaning of dollar sign at end of variable names in VB

I'm trying to alter some VBA (excel) code, which has about 5 authors (haha!), and I came across some function variables which have a dollar sign at the end of each of their names:

ByVal gold$

What the heck does the dollar sign do and mean? Never seen it used in VB before like that.
[306 byte] By [nethervoid] at [2007-11-11 7:06:44]
# 1 Re: Meaning of dollar sign at end of variable names in VB
This is what I refer to as "ancient type specifiers". It's a shorthand way of declaring a string variable. Most standards gurus would discourage this practice.

Our Clear VB tool fixes these - download the demo at www.tangiblesoftwaresolutions.com
David Anton at 2007-11-11 21:49:38 >
# 2 Re: Meaning of dollar sign at end of variable names in VB
Ahh thanks. And an ampersand is an integer? Just a guess.
nethervoid at 2007-11-11 21:50:42 >
# 3 Re: Meaning of dollar sign at end of variable names in VB
& -> Long
% -> Integer
# -> Double
! -> Single
@ -> Decimal
$ -> String

When VB.NET came out I was very surprised that these weren't finally dropped.
David Anton at 2007-11-11 21:51:40 >