
-----------------------------------
vg19
Fri Feb 06, 2004 10:49 pm

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

-----------------------------------
Paul
Sat Feb 07, 2004 12:50 am


-----------------------------------
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 :D

-----------------------------------
Tony
Sat Feb 07, 2004 2:39 pm


-----------------------------------
if you're new to VB, just go with dim, you'll do fine :)

-----------------------------------
Maverick
Sat Feb 07, 2004 2:46 pm


-----------------------------------
Ya with simpler progs all you need is Dim. Later on you will need to use the others.

-----------------------------------
Tony
Sat Feb 07, 2004 2:50 pm


-----------------------------------
well :? 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.

-----------------------------------
vg19
Sat Feb 07, 2004 2:50 pm


-----------------------------------
Not really new to VB. Did a gr10 course before. In the gr11, Im required to know all of these.

-----------------------------------
Maverick
Sat Feb 07, 2004 2:51 pm


-----------------------------------
and?

-----------------------------------
jonos
Sat Feb 07, 2004 2:52 pm


-----------------------------------
if im making a program, and i don't really know which one to use i just guess and hope it works...

-----------------------------------
Maverick
Sat Feb 07, 2004 2:53 pm


-----------------------------------
What kinda program you making? I probably have some code around if u need sum help.

-----------------------------------
Tony
Sat Feb 07, 2004 2:55 pm


-----------------------------------
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.
