DataView

S

scorpion53061

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.
 
M

Mountain Bikn' Guy

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
 
H

Hussein Abuthuraya[MSFT]

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.
 
S

scorpion53061

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

thank you mountain for trying to help.
 
S

scorpion53061

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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top