1. Global Variables over three projects
2. Global variables in a project.
How do I create an instance of a class that is accessible to all classes/forms in my project? I already have a startup module and I was thinking putting stuff in there and then accessing it through there. I need it for things like db connections, security manager, general db functions, ..... Any help would be appreciated..... UJ.
3. global variables for whole project not just when user form is runn - Word VBA
4. global variables for whole project not just when user form is
Thanks Jezebel for your quick response, but somehow I don't think I understand enough to interpret all your suggestions. What I've learnt in programming I've taught myself so can you please be more specific about how to make reference to the form object and making the data values available as properties of the form. Does that mean the input from User Form 1 will still be available once the user re-starts the programme and is using User Form 2? "Jezebel" wrote: > 'Global variables within modules' suggests you haven't quite understood > variable scoping. Variables declared at the top of a module are either > global -- meaning they are available to the entire project, or private -- > meaning they are available only within that module. Be aware that global > variables lose their value if you do any editing in VBA. > > Global variables have a bad reputation in programming: they are major cause > of bugs; and there are nearly always better ways to move data between > objects in the application. In your case, instead of using globals for each > data value, you could use a single global with a reference to form object, > then make the data values available as properties of the form. The > programming advantage is that the form 'owns' the data and can ensure that > it is valid. > > > > > "Bev" < XXXX@XXXXX.COM > wrote in message > news: XXXX@XXXXX.COM ... > > Can anyone help me. I've got a template project with 2 user forms. Code > > has > > to stop running between using the two user forms to enable the user to add > > unique information and check statements created to that point, before > > calculating of each statement occurs. Then the user re-starts the > > programme, > > so I'm trying to find a way to retain the variable information contained > > in > > the first user form, to be utilised in code for the 2nd user form. I > > already > > know about declaring global variables within modules, but I'm talking > > about > > retaining variable input for the whole project, over all modules. > > >
5. Global Variables nott Global?
6. Global Variables on a VB.NET Web Page
Hi: I'm a relative newby so hopefully this is a simple question! I have found that I can create global variables easily on a web page by placing the dim statement before the first "private sub" in a program: dim mydata as (whatever) Public Sub Page_Load(etc..) End Sub This makes information that I place in this global variable available to every click event on the page that I create just as it does in regular VB.NET apps. I'm curious to know if this is not a "best practice" - is info left in memory if the user clicks away - or is this a "great practice". I haven't seen any demos that use this so I'm curious if there is a down side Thanks very much! Fred
7. Question from a transforming VB guy on Global Variable - CSharp/C#
8. Global Variable Ends Up as Nothing in Form
Hi All, I'm an experienced VB6 developer and now starting (newbee) with VB 2008 and I'm very excited. Here's an issue I'm experiencing right off the starting line and cannot make sense of it: I have a module (Public) and in it contains a few global variables (String data type). When I go to use these in a Form the value is "Nothing." Why is this? .. Public Module modMain Public g_strMyPublicVar As String Then in the form (frmMain), the g_strMyPublicVar does not contain the data as it was set in modMain. Any insight is greatly appreciated and I thank you in advance! Kind regards - Fred