How can I share a SqlDataSet between all the forms of my application?, I´ve
create the dataset and fill it in the main form of my application and now I
need acess to the dataset in others forms.
I worc with c#

thakns

Re: share a Dataset by Ginny

Ginny
Tue Jul 06 14:04:28 CDT 2004

Félix,

One approach is to have a public property of the child forms that can hold a
reference to the dataset, and set that property before showing the child
form. Alternatively, you can use a private property for the child form and
pass in a reference to the dataset in the constructor. There are probably
some other approaches that would work too.

--
Ginny Caughey
.Net Compact Framework MVP



"Félix González" <felixgmartin(sobra esto)@terra.es> wrote in message
news:eaPC0c3YEHA.3988@tk2msftngp13.phx.gbl...
> How can I share a SqlDataSet between all the forms of my application?,
I´ve
> create the dataset and fill it in the main form of my application and now
I
> need acess to the dataset in others forms.
> I worc with c#
>
> thakns
>
>



Re: share a Dataset by Kevin

Kevin
Tue Jul 06 19:36:19 CDT 2004

This is more a programming problem that pocketpc. Anyway, in addition to the
previous post, you can use the Singleton pattern to make your dataset
available to your entire app.

class SomeClass
{
private static m_myDataSet;

public static DataSet getMyDataSet()
{
if (m_myDataSet == null)
{
//create dataset
}
return m_myDataSet;
}
}

Client code:

DataSet theDS = SomeClass.getMyDataSet();



"Félix González" <felixgmartin(sobra esto)@terra.es> wrote in message
news:eaPC0c3YEHA.3988@tk2msftngp13.phx.gbl...
> How can I share a SqlDataSet between all the forms of my application?,
I´ve
> create the dataset and fill it in the main form of my application and now
I
> need acess to the dataset in others forms.
> I worc with c#
>
> thakns
>
>