In order for it to be strongly typed, you need to use a Strongly Typed
DataSet. This part seems taken care of. What you should do is stick the
DataSet in a Module or Create it as a Shared Property of a class. Then you
can reference it from anywhere. Say you have a class with a Public Shared
Property of type YourStrongTypedDataset and the class is named DataHolder
and the property is MyDataSet.
In form1 you could reference it by DataHolder.MyDataSet. the same goes for
form2 , form3 or any other object . BC its shared (or static in C#) you
don't declare an instance of it, you just reference it directly. Also,
since you are in vb you could just create a module and reference it from
anywhere as MyDataSet although I think adding the prefix avoids possible
naming collisions and is clearer.
When the app loads you should first load this dataset and set the property.
Thereafter, say you have 3 tables and table 1 had 200 rows. Anywhere you
reference DataHolder.MyDataSet, if you check tables.count you'll see 3. You
can check DataHolder.MyDataSet.StronglyTypedTableName.Rows.C ount and you'd
get 100(assuming that table was the table I first mentioned.
You may want to create a TypedDataSet by adding it to your project so it's
its own class and that way you could reuse it later on if need be but that's
a side issue basically unrelated.
If you use the Desginer to build it, it'll be strongly typed so you can
refernce it DataSetName.ActualTableName and ActualTableName will appear in
intellisense (proving the strong typing) as opposed to having the reference
Tabes(0) or Tables("NameYouGaveIt").
HTH,
Bill
--
W.G. Ryan, eMVP
http://forums.devbuzz.com/ http://www.knowdotnet.com/williamryan.html http://www.msmvps.com/WilliamRyan/
"Chris Thunell" <ct******@pierceassociates.com> wrote in message
news:ea**************@TK2MSFTNGP09.phx.gbl...
I have 2 forms, on 1 form i use the wizards to create a strong typed
dataset with tables from an SQL database... and from that i can do stuff like:
me.daEmployee.fill(me.dataset11.tblEmployee) plus some 3rd party controls
can see it the datatables etc etc.
Is there anyway when i open the second form that this information that has
already been loaded into my in-memory dataset be available on all my other
forms... and still be strong typed. (i think i'm using "strong typed"
wording correctly)
I'm in Vstudio2003 and this is a windows forms project.
Any help would be greatly appreciated!
Chris