Tag Archives: Variables

Short Data Type

I would like to apologise to Katie, she was looking at the sequence of posts on the 2011 coursework and became confused with the “Short” data type. At the time I wrote the solution for the 2011 coursework we were using VB6, this uses the Integer data type to store whole numbers. When I created the articles in December, I opened up the original project using VB2008EE to capture the screen grabs. The import wizard unbeknownst to me had changed the data type to short. I should have noticed it but I missed it, sorry.

I’ll let the MS help do the explaining after the break.

Continue reading Short Data Type

DIM

DIM is used to dimensionalise a variable, that is set memory aside for the variable to be stored. It is used thus

  • DIM Number1 as Integer
  • DIM Number2 as Integer

However this can be shortened to

  • DIM Number1, Number2 as Integer

In this case VB(Express Edition) sets number1 & number2 to integers. A more complex example can be seen below

  • DIM StrName as String
  • DIM Number1, Number2 as Integer

Becomes

  • DIM StrName as String, Number1, Number2 as Integer

You need to be careful that you get your syntax correct. It might be easier at the start to stick with the traditional(top) method.