Declaring variables as Static vs Private/Public -- XML 
Author Message
 Declaring variables as Static vs Private/Public -- XML

If I declare a variable as Static in a Private Sub, it'll retain its value
even when the procedure ends, so why should I use it over the Private/Public
statement?

Also, what (common) situations is XML used in?  I'd like to use it for a
database (assuming it can be used - in a practical manner - as such). I'm
not familiar with it, so if someone could send me to a beginner's site,
that'd be appreciated.



Sun, 24 Oct 2004 07:42:08 GMT  
 Declaring variables as Static vs Private/Public -- XML
You may want the same variable name used in a variety of
classes/functions/subs. This is why we have Private - it limits the
scope of the variable. However, you also sometimes want to exit a sub,
and come back to it but for it to keep the same value.  This is when
we use Static. So we can have a Variable name used in a variety of
places, but each are seperate. Static allows the value contained in a
function/sub to be retained after exiting and then returning.

Hopefully all that made some sense...?

XML is greate if you have a database you want to connect to over the
internet, or if you want to provide a database to a Web form.  Can I
suggest you read O'Rilieys Books on VB (Spelling incorrect).  They
have a great section all about Web Forms, using XML as a database,
etc...

On Tue, 7 May 2002 19:42:08 -0400, "Matt Cullman"

Quote:

>If I declare a variable as Static in a Private Sub, it'll retain its value
>even when the procedure ends, so why should I use it over the Private/Public
>statement?

>Also, what (common) situations is XML used in?  I'd like to use it for a
>database (assuming it can be used - in a practical manner - as such). I'm
>not familiar with it, so if someone could send me to a beginner's site,
>that'd be appreciated.



Sun, 24 Oct 2004 07:59:37 GMT  
 Declaring variables as Static vs Private/Public -- XML
I think I see what you're saying.

I don't have any plans on using this app I'm currently working on with the
Internet, but I don't really want to use an Access DB (or whatever else).  I
want it to be easily moved from computer to computer and viewed from - for
example - Notepad.

Thanks for the info.  I've heard good things about O'Reiliy (spelling :)
books.


Quote:
> You may want the same variable name used in a variety of
> classes/functions/subs. This is why we have Private - it limits the
> scope of the variable. However, you also sometimes want to exit a sub,
> and come back to it but for it to keep the same value.  This is when
> we use Static. So we can have a Variable name used in a variety of
> places, but each are seperate. Static allows the value contained in a
> function/sub to be retained after exiting and then returning.

> Hopefully all that made some sense...?

> XML is greate if you have a database you want to connect to over the
> internet, or if you want to provide a database to a Web form.  Can I
> suggest you read O'Rilieys Books on VB (Spelling incorrect).  They
> have a great section all about Web Forms, using XML as a database,
> etc...

> On Tue, 7 May 2002 19:42:08 -0400, "Matt Cullman"

> >If I declare a variable as Static in a Private Sub, it'll retain its
value
> >even when the procedure ends, so why should I use it over the
Private/Public
> >statement?

> >Also, what (common) situations is XML used in?  I'd like to use it for a
> >database (assuming it can be used - in a practical manner - as such). I'm
> >not familiar with it, so if someone could send me to a beginner's site,
> >that'd be appreciated.



Sun, 24 Oct 2004 08:16:51 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. private vs public API declares

2. Public vs Private variables

3. Use a public variable or use Private variable with Get and Set

4. Public Type vs. Public variable() as Double

5. How do I declare a static global variable ?

6. Private Resultset vs. Public Resultset

7. Public vs Private

8. Option Explicit vs. Private/Public - Newbie

9. VB5: Option Private Module vs Public

10. Private vs Public functions & subs

11. Friend vs Private class and public

12. Private Resultset vs. Public Resultset

 

 
Powered by phpBB® Forum Software