Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 02:49:18 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  The equal sign in VB
Pages: 1   Go Down
Print
Author Topic: The equal sign in VB  (Read 716 times)
0 Members and 2 Guests are viewing this topic.
PSG
Active Member

Offline Offline

Posts: 21


View Profile
« 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
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 2,612



View Profile WWW
« Reply #1 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
Logged

stirling
Global Moderator
*
Offline Offline

Posts: 1,189

UK


View Profile WWW
« Reply #2 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)  Grin

Ian
Logged
PSG
Active Member

Offline Offline

Posts: 21


View Profile
« Reply #3 on: January 07, 2010, 12:22:34 PM »


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

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  Smiley)

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

TIA

* Auto_Zero_KentJanes.m1s (5.59 KB - downloaded 58 times.)
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!