By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,064 Members | 1,524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,064 IT Pros & Developers. It's quick & easy.

DataSet Collection From Componet Designer

P: n/a
Using vs2003, vb.net, msde...

I have Component Designer class that has many datasets in it. I would like
a way to iterate through the DataSets in an instantiation of the Component
Designer class, but don'see any collect available to do that.

' holds Dataset
Dim DS As DataSet

' instantiat component designer class

dim CD as new Component_Designer_Class

' will walk through all Data Sets in Component Designer class

For Each DS In CD.Collection ' *** no such collection command
exists

' code

Next

Any ideas?

Thanks Bob
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Bob,
You will need to manually create such a collection to enable enumerating
over it.

You may be able to use Reflection, however I would lean toward manually
defining the collection, simply to avoid picking up all the other child
objects...

Hope this helps
Jay

"Bob Day" <Bo****@TouchTalk.net> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
Using vs2003, vb.net, msde...

I have Component Designer class that has many datasets in it. I would like a way to iterate through the DataSets in an instantiation of the Component Designer class, but don'see any collect available to do that.

' holds Dataset
Dim DS As DataSet

' instantiat component designer class

dim CD as new Component_Designer_Class

' will walk through all Data Sets in Component Designer class

For Each DS In CD.Collection ' *** no such collection command
exists

' code

Next

Any ideas?

Thanks Bob

Nov 20 '05 #2

P: n/a
Hi Bob,

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter, and I
will be assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to build a dataset
collection in a class.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

Here is some code you may take a look.
Imports System.Data
Imports System.Collections
Module Module1
Public Class Component_Designer_Class
Public CS As New Collection
Public Sub New()
Dim i As Integer
For i = 1 To 10
Dim ds As New DataSet
ds.DataSetName = "dataset" + i.ToString
CS.Add(ds)
Next
End Sub
End Class
Sub Main()
Dim ds As DataSet
Dim CD As New Component_Designer_Class
For Each ds In CD.CS
Console.WriteLine(ds.DataSetName)
Next
End Sub
End Module

If you have any concern, please post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.