|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
declaring a dataset as publicHello,
I can't find out if a DataSet (and/or datatable) can be declared public so the xml data can be read to the DataSet in the form load, and then can be acessed from whatever sub or function for writing to the xml file whitout opening it all the time ... Can this be done? How? Thanks Vito Vito,
I am not sure I completely understand your question. In one of my projects I declare a dataset and datatable as public variables with no problem. Public myDataSet As New DataSet("State") 'creates the dataset Public myTable As DataTable 'creates the datatable These are global variables that I utilize through out the project. Hope this helps. Scott Moore Opa Vito wrote: Show quoteHide quote > Hello, > > I can't find out if a DataSet (and/or datatable) can be declared public > so the xml data can be read to the DataSet in the form load, and then > can be acessed from whatever sub or function for writing to the xml file > whitout opening it all the time ... > > Can this be done? How? > > Thanks > > Vito Vito,
I don't see the problem here, can you explain it a little bit more? Cor Show quoteHide quote "Opa Vito" <gebr***@dit.niet> schreef in bericht news:rLidncTpsaS-yrjYnZ2dnUVZ8qKdnZ2d@scarlet.biz... > Hello, > > I can't find out if a DataSet (and/or datatable) can be declared public so > the xml data can be read to the DataSet in the form load, and then can be > acessed from whatever sub or function for writing to the xml file whitout > opening it all the time ... > > Can this be done? How? > > Thanks > > Vito Opa Vito wrote:
> I can't find out if a DataSet (and/or datatable) can be declared public Yes, you can expose a DataSet as a property of your Form so that it can > so the xml data can be read to the DataSet in the form load, and then > can be acessed from whatever sub or function for writing to the xml file > whitout opening it all the time ... be used elsewhere in your Form and/or Project. Class Form1 Private Sub Form_Load( ... ) Handles MyBase.Load m_dsData = New DataSet m_dsData.Load( ... End Sub Public ReadOnly Property Data() as DataSet ' or DataTable Get Return m_dsData End Get End Property End Class Then, anywhere within Form1, you can access it as ? Me.Data. And, from elsewhere in your Project (provided you have a reference to the Form1 object), ? oFormRef.Data. Of course, if you only /have/ the one form, then you can make the Data Property private (to the Form) in which case the first example above will work, but the second will not. HTH, Phill W. Show quoteHide quote > > Can this be done? How? > > Thanks > > Vito Opa Vito schreef:
> I can't find out if a DataSet (and/or datatable) can be declared public I had problems with the XML file. It got corrupted everytime I had to > so the xml data can be read to the DataSet in the form load, and then > can be acessed from whatever sub or function for writing to the xml file > whitout opening it all the time ... write to it from a certain function, not from all functions. And the code seemed OK. But I always declared the Dataset and read the XML file into it in all functions who had to deal with the dataset, and that was the mistake I made (I think). Thanks to you I now managed to declare the Dataset public, read the XML file into the Dataset at form1 load and the problem is gone. So far I can use the Dataset now from everywhere without problems. Vito
Help with encrypted web pages?
Thread, UI update is this ok? Redim Multidimenional Arrays Can a custom object know it's owner Importing DLLs during runtime PrintPreviewDialog Control and HTML search user in active directory Can I create controls with static ID's? Drag Bitmap tutorial/code anywhere? Encoding question |
|||||||||||||||||||||||