I would like to load a dataset, create a dataview and reference that
dataview in another form. I decalred in a module
Public dv as Dataview

and in the the form's loading process I fill the data set and say:

dv = dstest.Tables(0).DefaultView

then on the form where I am going ot use the view:

If TabControl1.SelectedIndex = 4 Then
dv = New DataView(Dstest1.Tables("test"), "TypeOfCitation =
'testtype'", "sorttest", DataViewRowState.CurrentRows)
DataGridSH.DataSource = dv
DataGridSH.Visible = True
Exit Sub
End If

I tried inheriting the form it was built on and that didn't work.

Do I need to remove references in the code of the form getting the dataview
to the dataset being used? Or am I missing something else?

I never dispose of that form that it was created on.

Re: DataView by Mountain

Mountain
Fri Dec 05 16:56:21 CST 2003

Hey, I'm not a VB guy, but it looks to me like the problem is the way you
are assigning to dv on your 2nd form. Just assign the reference to the
original dv (maybe make a public property on your first form for dv) to your
2nd dv. Don't use "New".
HTH

"scorpion53061" <scorpion_53061nospamhereplease@yahoo.com> wrote in message
news:%23OYMtC4uDHA.2360@TK2MSFTNGP09.phx.gbl...
> I would like to load a dataset, create a dataview and reference that
> dataview in another form. I decalred in a module
> Public dv as Dataview
>
> and in the the form's loading process I fill the data set and say:
>
> dv = dstest.Tables(0).DefaultView
>
> then on the form where I am going ot use the view:
>
> If TabControl1.SelectedIndex = 4 Then
> dv = New DataView(Dstest1.Tables("test"), "TypeOfCitation =
> 'testtype'", "sorttest", DataViewRowState.CurrentRows)
> DataGridSH.DataSource = dv
> DataGridSH.Visible = True
> Exit Sub
> End If
>
> I tried inheriting the form it was built on and that didn't work.
>
> Do I need to remove references in the code of the form getting the
dataview
> to the dataset being used? Or am I missing something else?
>
> I never dispose of that form that it was created on.
>
>
>



RE: DataView by HussAb

HussAb
Fri Dec 05 18:29:10 CST 2003

Declare the DataView in the general declaration area of the first form as:

Friend Shared dv As DataView

and then to use that dv object in the second form use:

Form1.cr

I hope this helps!


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.



Re: DataView by scorpion53061

scorpion53061
Fri Dec 05 18:41:12 CST 2003

I solved the shared dataview issue. If anyone wants to know more post here.

thank you mountain for trying to help.

"Mountain Bikn' Guy" <vc@attbi.com> wrote in message
news:p28Ab.432553$HS4.3405629@attbi_s01...
> Hey, I'm not a VB guy, but it looks to me like the problem is the way you
> are assigning to dv on your 2nd form. Just assign the reference to the
> original dv (maybe make a public property on your first form for dv) to
your
> 2nd dv. Don't use "New".
> HTH
>
> "scorpion53061" <scorpion_53061nospamhereplease@yahoo.com> wrote in
message
> news:%23OYMtC4uDHA.2360@TK2MSFTNGP09.phx.gbl...
> > I would like to load a dataset, create a dataview and reference that
> > dataview in another form. I decalred in a module
> > Public dv as Dataview
> >
> > and in the the form's loading process I fill the data set and say:
> >
> > dv = dstest.Tables(0).DefaultView
> >
> > then on the form where I am going ot use the view:
> >
> > If TabControl1.SelectedIndex = 4 Then
> > dv = New DataView(Dstest1.Tables("test"), "TypeOfCitation =
> > 'testtype'", "sorttest", DataViewRowState.CurrentRows)
> > DataGridSH.DataSource = dv
> > DataGridSH.Visible = True
> > Exit Sub
> > End If
> >
> > I tried inheriting the form it was built on and that didn't work.
> >
> > Do I need to remove references in the code of the form getting the
> dataview
> > to the dataset being used? Or am I missing something else?
> >
> > I never dispose of that form that it was created on.
> >
> >
> >
>
>



Re: DataView by scorpion53061

scorpion53061
Sat Dec 06 09:04:13 CST 2003

Hi Hussein,

I was taught datasets and dataadapters could not be inherited across forms.
Yet I am able to share a dataset through a class.
I am confusing inheritance and sharing arent I?

"Hussein Abuthuraya[MSFT]" <HussAb@online.microsoft.com> wrote in message
news:Bm946$4uDHA.2656@cpmsftngxa07.phx.gbl...
> Declare the DataView in the general declaration area of the first form as:
>
> Friend Shared dv As DataView
>
> and then to use that dv object in the second form use:
>
> Form1.cr
>
> I hope this helps!
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.
>
>