Vb2005

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MikeCS
    New Member
    • Nov 2006
    • 3

    #1

    Vb2005

    Problem:
    I wanted to implement what I did in VB6 where I would use a global structure and dimension an array of structures then the program could load data into it at start up. Global routines would be able access the data whenever required and save any changes. Since it isn't a lot of data, I don't want the overhead of a dbms.

    With VB2005 (express) I created a class that consisted essentially of one record of the previous structure. Now I have 2 problems:
    How do I create a number of instances of the class where I can access all the properties and methods?
    How can the rest of the program access the data since I have to instantiate the class in another class (such as a form)?

    Solutions?:
    Can I create an array of global objects with certain methods shared between objects for loading/saving and other common tasks (I think this can be accomplished with the Shared keyword)

    Or
    Would it be better for the objects to be created/destroyed as needed with the common methods (such as load/save etc.) available at all times (through the Shared keyword). Then the data would be read and written to disk when interacting with the objects. In effect disk storage, rather than RAM storage would make the data globally available to the program.

    Or
    Would it work and perhaps be better just to create an array of a structure inside the class so all the data is encapsulated inside the class and then use #2 above (except only one instance of the class need be instantiated (and thus, no methods would need to be shared))

    Any help would be appreciated--trying to make the conceptual leap to OOP
Working...