• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Need Help With DataSet retrevial

Hi

I am using VB.Net 2005 and have created the following dataset with a click event on Form2. My question, being new to this, is how to retrieve this dataset on Form3 or for that matter on Form2?

Thanks

PBLack

'build report dataset
        Dim dt As New DataTable("StandInfo")
        dt.Columns.Add("StandNum")
        dt.Columns.Add("Area")
        dt.Columns.Add("SampleSize")
        dt.Columns.Add("TotalPoints")
        dt.Columns.Add("Intensity")

        Dim row As DataRow = dt.NewRow()
        Dim item As ListViewItem
        For Each item In lvStands.Items
            row("StandNum") = item.Text
            row("Area") = item.SubItems(1).Text
            row("SampleSize") = item.SubItems(2).Text
            row("TotalPoints") = item.SubItems(3).Text
            row("Intensity") = item.SubItems(4).Text
            dt.Rows.Add(row)
            row = dt.NewRow()
        Next
0
PBLack
Asked:
PBLack
2 Solutions
 
DEEPESHCommented:
Simple declare a property on form3 or better declare a constructor with dataset as a parameter on form3
such as
Public Sub New (byval ds as dataset)
'Now assign this ds to a variable of type dataset
'and then you can read ds
end sub
0
 
PBLackAuthor Commented:
I my example I created a table. No where did I declare a dataset ... is what I did ok? Will it still fit in with your example?

My end goal is to populate listviews and textboxes with this data as I build it. Also where is the datatable stored? In memory?
0
 
ReecioCommented:
if you want to create a dataset in code that's usable over the other forms you'll have to publically declare the variable, otherwise its just allocated to that sub.
Just under Public Class Form1 put Public ds As DataSet and in other forms you should eb able to reference Form1.ds etc.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now