Home All Groups Group Topic Archive Search About

Referencing a common instance of a Dataset

Author
12 Feb 2007 7:50 PM
bidalah
Hello all,

I am sure there is a simple answer to this question.  There just isn't
a simple way to describe it for a search engine.

I have a vb.net program consisting of several windows forms,
miscellanenous classes, and modules.  I want all of these classes to
access and update the same instance of an ado dataset and I'm unable
to do it. I thought I could simply create a new instance of the
dataset in a public module.  I can't;  I still lose all information
storied in the datatable by a child routine as soon as that routine
"returns" to the parent.

Ofcourse I could reference the dataset in every function and
explicitly 'return' it at the end, but that seems unecessarily
complex, particularly since many of the functions that are updating
the dataset are already returning other information.  Can anyone tell
me what the procedure is to define a common dataset instance?

Author
12 Feb 2007 8:00 PM
Marina Levit [MVP]
If you had a pointer to that dataset (or any object) in a module, it would
not get lost when any function returned. It sounds like you weren't doing it
right, perhaps posting relevant code would help.

<bida***@yahoo.com> wrote in message
Show quote
news:1171309842.239635.296310@j27g2000cwj.googlegroups.com...
> Hello all,
>
> I am sure there is a simple answer to this question.  There just isn't
> a simple way to describe it for a search engine.
>
> I have a vb.net program consisting of several windows forms,
> miscellanenous classes, and modules.  I want all of these classes to
> access and update the same instance of an ado dataset and I'm unable
> to do it. I thought I could simply create a new instance of the
> dataset in a public module.  I can't;  I still lose all information
> storied in the datatable by a child routine as soon as that routine
> "returns" to the parent.
>
> Ofcourse I could reference the dataset in every function and
> explicitly 'return' it at the end, but that seems unecessarily
> complex, particularly since many of the functions that are updating
> the dataset are already returning other information.  Can anyone tell
> me what the procedure is to define a common dataset instance?
>
Author
12 Feb 2007 9:14 PM
bidalah
Show quote
On Feb 12, 2:00 pm, "Marina Levit [MVP]" <mari***@comcast.net> wrote:
> If you had a pointer to that dataset (or any object) in a module, it would
> not get lost when any function returned. It sounds like you weren't doing it
> right, perhaps posting relevant code would help.
>
> <bida***@yahoo.com> wrote in message
>
> news:1171309842.239635.296310@j27g2000cwj.googlegroups.com...
>
>
>
> > Hello all,
>
> > I am sure there is a simple answer to this question.  There just isn't
> > a simple way to describe it for a search engine.
>
> > I have a vb.net program consisting of several windows forms,
> > miscellanenous classes, and modules.  I want all of these classes to
> > access and update the same instance of an ado dataset and I'm unable
> > to do it. I thought I could simply create a new instance of the
> > dataset in a public module.  I can't;  I still lose all information
> > storied in the datatable by a child routine as soon as that routine
> > "returns" to the parent.
>
> > Ofcourse I could reference the dataset in every function and
> > explicitly 'return' it at the end, but that seems unecessarily
> > complex, particularly since many of the functions that are updating
> > the dataset are already returning other information.  Can anyone tell
> > me what the procedure is to define a common dataset instance?- Hide quoted text -
>
> - Show quoted text -

Hi Marina,

Thanks for replying.  There isn't much code to see.  This is vb.net so
there are no explicit pointers.  Following is the basic code:

Module VisualADPVariables
     Public VADP_DataSetMain As New VisualADP_Dataset  'Creating a new
instance of my Dataset
End Module


Public Class ConvertFiles
     Public EPStoVectorPCL1 as new EPStoVectorPCL  'establishing an
instance of another class

     Public Sub ToVectorPCL(ByVal sender As System.Object, ByVal e As
System.EventArgs)

           'At this point a table called "STRINGDATA" in the
VADP_Dataset is empty

               theVPCLFileName =
EPStoVectorPCL1.PROCESSEPSFORM(FormtoConvert, CurrentSourceDir,
CurrentEditedFinDir, SizeArray(2), SizeArray(3),
               CurrentFormScaleFactor_X, CurrentFormScaleFactor_Y)

              ' the above function populated STRINGDATA with over 1000
rows of data.  I have confirmed that this is happening

    End Sub     '  A count of the rows in VADP_DatasetMain.STRINGDATA
taken here is "0"
End Class
Author
13 Feb 2007 8:47 AM
Garik
Hi,

How are you filling the "STRINGDATA" table in your dataset?

--
Regards,
Garik Melkonyan
MCP, MCAD, MCSD .NET


Show quote
"bida***@yahoo.com" wrote:

> On Feb 12, 2:00 pm, "Marina Levit [MVP]" <mari***@comcast.net> wrote:
> > If you had a pointer to that dataset (or any object) in a module, it would
> > not get lost when any function returned. It sounds like you weren't doing it
> > right, perhaps posting relevant code would help.
> >
> > <bida***@yahoo.com> wrote in message
> >
> > news:1171309842.239635.296310@j27g2000cwj.googlegroups.com...
> >
> >
> >
> > > Hello all,
> >
> > > I am sure there is a simple answer to this question.  There just isn't
> > > a simple way to describe it for a search engine.
> >
> > > I have a vb.net program consisting of several windows forms,
> > > miscellanenous classes, and modules.  I want all of these classes to
> > > access and update the same instance of an ado dataset and I'm unable
> > > to do it. I thought I could simply create a new instance of the
> > > dataset in a public module.  I can't;  I still lose all information
> > > storied in the datatable by a child routine as soon as that routine
> > > "returns" to the parent.
> >
> > > Ofcourse I could reference the dataset in every function and
> > > explicitly 'return' it at the end, but that seems unecessarily
> > > complex, particularly since many of the functions that are updating
> > > the dataset are already returning other information.  Can anyone tell
> > > me what the procedure is to define a common dataset instance?- Hide quoted text -
> >
> > - Show quoted text -
>
> Hi Marina,
>
> Thanks for replying.  There isn't much code to see.  This is vb.net so
> there are no explicit pointers.  Following is the basic code:
>
> Module VisualADPVariables
>      Public VADP_DataSetMain As New VisualADP_Dataset  'Creating a new
> instance of my Dataset
> End Module
>
>
> Public Class ConvertFiles
>      Public EPStoVectorPCL1 as new EPStoVectorPCL  'establishing an
> instance of another class
>
>      Public Sub ToVectorPCL(ByVal sender As System.Object, ByVal e As
> System.EventArgs)
>
>            'At this point a table called "STRINGDATA" in the
> VADP_Dataset is empty
>
>                theVPCLFileName =
> EPStoVectorPCL1.PROCESSEPSFORM(FormtoConvert, CurrentSourceDir,
> CurrentEditedFinDir, SizeArray(2), SizeArray(3),
>                CurrentFormScaleFactor_X, CurrentFormScaleFactor_Y)
>
>               ' the above function populated STRINGDATA with over 1000
> rows of data.  I have confirmed that this is happening
>
>     End Sub     '  A count of the rows in VADP_DatasetMain.STRINGDATA
> taken here is "0"
> End Class
>
>
>
>
Author
13 Feb 2007 3:34 PM
bidalah
On Feb 13, 12:47 am, Garik <garik_ma@do not spam.yahoo.com> wrote:
Show quote
> Hi,
>
> How are you filling the "STRINGDATA" table in your dataset?
>
> --
> Regards,
> Garik Melkonyan
> MCP, MCAD, MCSD .NET
>
>
>
> "bida***@yahoo.com" wrote:
> > On Feb 12, 2:00 pm, "Marina Levit [MVP]" <mari***@comcast.net> wrote:
> > > If you had a pointer to that dataset (or any object) in a module, it would
> > > not get lost when any function returned. It sounds like you weren't doing it
> > > right, perhaps posting relevant code would help.
>
> > > <bida***@yahoo.com> wrote in message
>
> > >news:1171309842.239635.296310@j27g2000cwj.googlegroups.com...
>
> > > > Hello all,
>
> > > > I am sure there is a simple answer to this question.  There just isn't
> > > > a simple way to describe it for a search engine.
>
> > > > I have a vb.net program consisting of several windows forms,
> > > > miscellanenous classes, and modules.  I want all of these classes to
> > > > access and update the same instance of an ado dataset and I'm unable
> > > > to do it. I thought I could simply create a new instance of the
> > > > dataset in a public module.  I can't;  I still lose all information
> > > > storied in the datatable by a child routine as soon as that routine
> > > > "returns" to the parent.
>
> > > > Ofcourse I could reference the dataset in every function and
> > > > explicitly 'return' it at the end, but that seems unecessarily
> > > > complex, particularly since many of the functions that are updating
> > > > the dataset are already returning other information.  Can anyone tell
> > > > me what the procedure is to define a common dataset instance?- Hide quoted text -
>
> > > - Show quoted text -
>
> > Hi Marina,
>
> > Thanks for replying.  There isn't much code to see.  This is vb.net so
> > there are no explicit pointers.  Following is the basic code:
>
> > Module VisualADPVariables
> >      Public VADP_DataSetMain As New VisualADP_Dataset  'Creating a new
> > instance of my Dataset
> > End Module
>
> > Public Class ConvertFiles
> >      Public EPStoVectorPCL1 as new EPStoVectorPCL  'establishing an
> > instance of another class
>
> >      Public Sub ToVectorPCL(ByVal sender As System.Object, ByVal e As
> > System.EventArgs)
>
> >            'At this point a table called "STRINGDATA" in the
> > VADP_Dataset is empty
>
> >                theVPCLFileName =
> > EPStoVectorPCL1.PROCESSEPSFORM(FormtoConvert, CurrentSourceDir,
> > CurrentEditedFinDir, SizeArray(2), SizeArray(3),
> >                CurrentFormScaleFactor_X, CurrentFormScaleFactor_Y)
>
> >               ' the above function populated STRINGDATA with over 1000
> > rows of data.  I have confirmed that this is happening
>
> >     End Sub     '  A count of the rows in VADP_DatasetMain.STRINGDATA
> > taken here is "0"
> > End Class- Hide quoted text -
>
> - Show quoted text -
Author
13 Feb 2007 3:37 PM
bidalah
Not "filling" in terms of populating the datatable from a database.  I
am determing text data that needs to be used by the program in a later
process and storing it row by row into the dataset until it is used.
My program is doing this perfectly, but when the load routines are
completed and the program returns to the parent routine, the data is
not there.
Author
14 Feb 2007 9:24 AM
Garik
Provide exactly the code that you're using when adding rows to the datatable.

Garik


Show quote
"bida***@yahoo.com" wrote:

> Not "filling" in terms of populating the datatable from a database.  I
> am determing text data that needs to be used by the program in a later
> process and storing it row by row into the dataset until it is used.
> My program is doing this perfectly, but when the load routines are
> completed and the program returns to the parent routine, the data is
> not there.
>
>
>

AddThis Social Bookmark Button