Classic VB - What's wrong with Dim x, y, z As Long ?
<style type="text/css">span.vbk{font-weight:bold;color:darkblue;}span.small{font-size:8pt;}div.vbc{margin:15px auto;width:85%; background:white;border:1px dashed gray;padding: 5px;font-family:'Lucida Console',monospace;}</style><div style="text-align: justify;font-size: 10pt;font-family:'Trebuchet MS','Segoe UI',Tahoma,sans-serif;padding:0 15px;">If you have used C-style languages, you may be used to this notation:
<div class="vbc">int x, y, z;</div>which declares 3 variables x, y, and z of the type <span class="vbk">int</span>.
You may have also used this in VB.NET:
<div class="vbc">Dim x, y, z As Long</div>which declares the three variables of type <span class="vbk">Long</span>.
So it's only natural that you would expect to do the same in VB6 (or earlier). Unfortunately, pre VB.NET, the syntax does not mean the same thing. If you declare a variable without specifying a type, you are effectively declaring it as a Variant.
<div class="vbc">Dim x ' x is a Variant</div>
Declaring multiple variables in the shorthand manner seen above will result in x and y typed as <span class="vbk">Variant</span>, and only z as a <span class="vbk">Long</span>, when you intended all three to be <span class="vbk">Long</span>'s.
In Visual Basic.NET Variants were removed from the language altogether as they did not fit with the .NET type system. The statement Dim x in VB.NET actually declares x as an <span class="vbk">Object</span>, but the behaviour of the shorthand declaration was changed so that all untyped variables are declared as the next type keyword that appears in the declaration statement. Just remember that this is NOT the case in Classic VB :)</div>