I created this for you... here is the button code:
Hope this helps:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim Lifts As New List(Of MyLifts)
Dim myds As New DataSet 'Temp Dataset for example purposes
'Putting data in
For nI As Integer = 1 To 5
Dim TempLifts As New MyLifts
TempLifts.LiftDataset = myds
TempLifts.LiftId = nI.ToString
Lifts.Add(TempLifts)
Next
'Retrieving data
For nI As Integer = 0 To (Lifts.Count - 1)
Dim LiftId As String = Lifts(nI).LiftId
Dim LiftDataset As DataSet = Lifts(nI).LiftDataset
Next
End Sub
and a class I created:
Public Class MyLifts
Private _LiftID As String
Private _LiftDataset As DataSet
Public Property LiftId() As String
Get
Return _LiftID
End Get
Set(ByVal value As String)
_LiftID = value
End Set
End Property
Public Property LiftDataset() As DataSet
Get
Return _LiftDataset
End Get
Set(ByVal value As DataSet)
_LiftDataset = value
End Set
End Property
End Class
====
Cheers'
Miro
"Your Name Here" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)160N...
> Miro wrote:
>> I am not sure I exactly know what you are trying to sort through - so
>> sorry
>> if I misunderstood you.
>>
>> What about creating a class with a property that is a dataset.
>>
>> Then instantiate that class with a "List( of T )"...
>> and keep adding to that one. Here since you can add as many properties
>> as
>> you need with your class, you can make properties such as "lift id",
>> "dataset", "some other informaiton what lift id is doing"
>>
>>
>>
>> that or creating a hash table the id is the LiftID, - something like
>> this:
>> Dim LiftIDs As New Hashtable
>> LiftIDs.Add(LiftIDs, dataset)
>>
>>
>>
>>
>> "Aussie Rules" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Hi,
>>>
>>> I have a query that returns a datatset, that contains a table that holds
>>> a
>>> bunch of data. One of the columns is "lift_id"
>>>
>>> The lift id shows what lift needs to be uses, and for different people
>>> using the application there will be a different number of lifts.
>>>
>>> What I need to be able to do is to somehow dynamicly create a number of
>>> in
>>> memory tables(as I have no need to keep, and they last only for a few
>>> minutes each time), each containing the data for the lift. For example,
>>> dataset 1 contains all the information for lift 1, dataset 2 contains
>>> all
>>> the information for lift 2 and so on. Because the number of lifts will
>>> always be different, then I can't fix the number of datasets.
>>>
>>> Once this is done, I have to step through each dataset, and as some
>>> lifts
>>> are faster than others, I need to be able to move/step through the
>>> dataset
>>> item by item, but always be able to see what lift is doing what item.
>>>
>>> Is there away I can do this ?
>>>
>>>
>>>
>>
> Hi Miro.
>
> Thanks for your reply.
>
> I like the idea of using a class where I can add a dataset as a property.
>
> I have only played a bit with classes, and only with strings and integers.
> I
> did actually start to create a class for the lift, but didn't know that
> you
> could have a dataset as a property. How do you declare a property that
> is a
> dataset ?
>
> I assume that to retrieve the dataset one would go dim ds as dataset =
> classname.datasetPropertyName ?
>
> Is that correct.
>
> Thanks....
|