Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic question about Dim statement??? 1

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
Two questions about the following:

Dim s, fldCode$

1. What happens when you don't define the datatype like above?

2. What does the $ signify at the end of a memvar?

Thanks,

Steve728
 
If you don't give a type it is defined as variant. Do some searching on late binding versus early binding.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
In VB.NET an untyped variable is treated as an Object. There is no Variant datatype in VB.NET.

The $ on the end of a variable name will cause it to be assigned as a String.



Bob Boffin
 
Ooops...thought I was in the wrong forum. My apologies.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Depending on the options you have set for your project, not giving a variable a type will cause an error. Option Explicit on forces you to declare a type for your variables.
 
BTW if you don't set Option Explicit then if you forget to declare the type of a Function it will also default to Object and not give you an error.

Found that one by mistake!



Bob Boffin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top