Computer Science Canada

Private, Static, Dim, Public....When do I use each one

Author:  vg19 [ Fri Feb 06, 2004 10:49 pm ]
Post subject:  Private, Static, Dim, Public....When do I use each one

hey,

Im confused on the declarations of variables. When would I use dim, private, static, public etc. Any websites would be great

thnx

Author:  Paul [ Sat Feb 07, 2004 12:50 am ]
Post subject: 

I dunno any VB, but I did a little research to try and help you. This site might help you:
http://www.red-hotpokers.co.uk/vbvariables02.htm
This has a list of variables and what they're used for I think...
hope this helps you Very Happy

Author:  Tony [ Sat Feb 07, 2004 2:39 pm ]
Post subject: 

if you're new to VB, just go with dim, you'll do fine Smile

Author:  Maverick [ Sat Feb 07, 2004 2:46 pm ]
Post subject: 

Ya with simpler progs all you need is Dim. Later on you will need to use the others.

Author:  Tony [ Sat Feb 07, 2004 2:50 pm ]
Post subject: 

well Confused Just if you're going for efficiency or what not. Such as static will just save you memory and public/private sets level of access to that variable from other functions.

Author:  vg19 [ Sat Feb 07, 2004 2:50 pm ]
Post subject: 

Not really new to VB. Did a gr10 course before. In the gr11, Im required to know all of these.

Author:  Maverick [ Sat Feb 07, 2004 2:51 pm ]
Post subject: 

and?

Author:  jonos [ Sat Feb 07, 2004 2:52 pm ]
Post subject: 

if im making a program, and i don't really know which one to use i just guess and hope it works...

Author:  Maverick [ Sat Feb 07, 2004 2:53 pm ]
Post subject: 

What kinda program you making? I probably have some code around if u need sum help.

Author:  Tony [ Sat Feb 07, 2004 2:55 pm ]
Post subject: 

alright then...

dim is the basic declaration of the variable. You dont really have to declear variables in VB, IDE does that for you. But if you want to declear it, that's the method of choice.

static is a constant. You assign it a value at declaraction and cannon change it later. An example would be something like value of pi.

public/private is a variable modifier that sets its access level. Basically if the variable is private then it can be accessed from within the function it was decleared in. If it's public, then you can access that variable from other functions.


: