Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: PSG on January 06, 2010, 05:31:15 PM

Title: The equal sign in VB
Post by: PSG on January 06, 2010, 05:31:15 PM

Please bare with me. I am trying to learn VB so the some of the questions may seem silly or stupid. Up until now, the Cypress VB doc is only partially helpful. I seem to have better luck by reading actual known/working scripts and deciphering the operation.

The questions I have (today) are in regards to "DIM" and "=".

1. If I where to assign values/names using the "=", can I therefore just use that name in script that follows instead?
2. What does "DIM" do?

Again not trying to ask silly/stupid questions. Just trying to get a handle on VB.

TIA
Title: Re: The equal sign in VB
Post by: ger21 on January 06, 2010, 08:07:50 PM
1) I think yes, but am not clear what you mean. Like this?

a=1
b = a+2

2) I better let a programmer explain that. Or you can try reading this.
http://msdn.microsoft.com/en-us/library/7ee5a7s1(VS.80).aspx
Title: Re: The equal sign in VB
Post by: stirling on January 07, 2010, 07:41:16 AM
dim is short for dimension. Originally it was only used to specify arrays and later became used for scalar values as well. Its just BASICs syntax for defining a variable.

so DIM x as integer tells the basic interpreter to:

allocate (dimension) the required number of bytes on the stack to be used as storage for an integer value and point the symbol table entry for the name x in the current stack frame at it. (well you did ask)  ;D

Ian
Title: Re: The equal sign in VB
Post by: PSG on January 07, 2010, 12:22:34 PM

Thank you to both of you. You are right Ian, I did ask  ;D . It must be some sort of insanity that sets in after a while  ;D

I have always known the usefulness of custom macros in Mach but I am really starting to see the real power that is available. The questions come from an auto-zero script posted by another Mach user. I already have a zero script that works well so I am not in a bind to make one work but in reading this script I see the "DIM" and of course the "equals" sign. I was always under the impression that in order write scripts for Mach that I would need to memorize an endless list of commands and oem codes. In reading this script, it gives the feel of the old "basic" (Commadore64 stuff - the last time I ever wrote a piece of code  :))

If you guys or someone can help me define the attached script, I think it will be a great help in understanding.

TIA