Real Newb Programmer questions

Robkemp76

Member
Joined
Nov 30, 2004
Messages
6
Programming Experience
Beginner
No better term than Newb for this I'd imagine... Here goes..

I have an application that I have multiple forms using the same information. 3 different forms use the same data from a dataset, 2 forms use properties I've created in one of the first forms. All of this is done through leaving a form up but hidden and proceeding to another form.

I would like to find something that would allow me to place static information into my application and leave it all shared. If tried to do this with a Class item in Visual Studio however ever instantiation starts the class with no data input. And I can't access the class of course unless I instatiate it. So I'm kind of at a loss. What component, item, or whatever... method perhaps could I employ to have a single location for most of my applications shared data? I've looked at modules but I'm not to sure what a module really is. Most descriptions I've found of modules are vague at best. Every one seems to like name spaces and classes over modules it would seem....
 

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,461
Programming Experience
10+
In VB.NET you can use a Module, just like in VB6. That would be your easiest solution for now.
 

bloukewer

Well-known member
Joined
Jul 2, 2004
Messages
88
Programming Experience
3-5
1.Create a Module
2. Inside that module, declare a Friend instance of the form you are hiding
ex. Friend frm1 as Form1
3. In the load_event of the "hidden form", place the code frm1 = me (replace frm1 with whatever name you gave the friend-variable in step 2)
4. If you need to refer to a field on the hidden form, just say frm1.exampleTextbox.text

You can declare "Global Variables" in the same way as steps 1 to 3, for example an integer called I1. You can call this variable anywhere in your code for example in the load_sub of your main form: I1 = 21.
 
Top Bottom