Re: VB6 and global variables
From: YYZ (notapplicable)
Date: 04/12/04
- Next message: Don Quijote de Nicaragua: "Re: Multilangual : how to?"
- Previous message: Gary German: "Re: VB6 and global variables"
- In reply to: Don_at_home.com: "Re: VB6 and global variables"
- Next in thread: Don_at_home.com: "Re: VB6 and global variables"
- Reply: Don_at_home.com: "Re: VB6 and global variables"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Apr 2004 15:18:43 -0500
<Don@home.com> wrote in message
news:shtl70p39j07a8qu4p02c4qu63ngo6lng9@4ax.com...
> On Mon, 12 Apr 2004 12:56:05 -0700, "Pete"
<anonymous@discussions.microsoft.com>
> wrote:
>
> >Hi All,
> >
> >Let me start by saying I know it is a bad programming practice.....
Yeah, it makes me shiver. Are you sure you need to do this? I can understadn
coding yourself into a corner, or inheriting a project that has already put you
there, but are you sure you can't do a global replace on one of them? Just a
suggestion.
> >If you have a GLOBAL variable (in a bas module) and you have a form and
inside of that form you have a variable that uses the same name as the GLOBAL,
how do you access the GLOBAL and not the routines version of the variable?
>
> For what ever its worth these varible names would be ambiguous...
> Change one...
Nope. Assuming 2 variables called sMyGlobal, VB would know exactly which one it
needed (if not what you really intended <g>). If you referred to sMyGlobal in
the form, it would find the pointer to the forms variable sMyGlobal. Anywhere
else, if you referred to sMyGlobal, then it would find the pointer to the
variable in the module.
If you want to specify try this (from the form):
Debug.Print Me.sMyGlobal, Module1.sMyGlobal
Just qualify which variable you want by specifying the module name (a form is a
module, too, if I'm not mistaken)
Matt
- Next message: Don Quijote de Nicaragua: "Re: Multilangual : how to?"
- Previous message: Gary German: "Re: VB6 and global variables"
- In reply to: Don_at_home.com: "Re: VB6 and global variables"
- Next in thread: Don_at_home.com: "Re: VB6 and global variables"
- Reply: Don_at_home.com: "Re: VB6 and global variables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|