|
-
October 26th, 2009, 03:24 PM
#1
Class/Form Instance Problems
I want to display data from a DataSet i have created in visual studio in a dataViewGrid.
I want to read data into the DataSet in tables from an XML file at runtime, and to be able to access the dataset from various different forms/classes.
I have tried to create an instance of the typed dataset i have created, but i cant find a way of accessing it unless its declared in the same class. I want only one instance of the dataset to maintain the data integrity, so passing multiple instances of the dataset to classes as params is not acceptable.
I have tried created an instance of the dataset in one class, and accessing it from another class using the someClass.dataset syntax to no avail.
How can i get around this problem of my dataset not existing in the context i want to use it?
Any help.... PLEASE!
-
October 26th, 2009, 06:31 PM
#2
Re: Class/Form Instance Problems
Nice ID, but it could not be further from the truth... unless you follow it with ...javaequalsCplusplus4dummies I'm dead...
When you 'pass' the DataSet to other classes, you will only be passing a reference to it, not another copy. There will only be one copy of the DataSet, so any changes will be reflected across all references.
I do not understand why you would not be able to put it in a class and and then access it from a member function/property. Can you post some example code, remember to put it between [C O D E] code here and [/ C O D E] tags (with no spaces).
Also, remember that the DataSet itself is an object (instance of a class)...
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
-
October 27th, 2009, 04:38 AM
#3
Re: Class/Form Instance Problems
try to declare a one single static dataset object and use it in all places you need it..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|