Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SortedList collection iteration

Posted on 2003-03-31
4
Medium Priority
?
267 Views
Last Modified: 2008-02-01
I have an object objDocuments based on sortedList class. Each item of the objDocuments is of CDocument class.

I just need to know how to iterate through objDocuments to retrieve properties of CDocuments. I have the following code, but it doesnt recognise CDocument.Title and such. Any ideas or suggestions would be appreacaited:

Dim document As CDocument
Dim objEnm As IEnumerator = objDocuments.GetEnumerator()

While objEnm.MoveNext
            ListBox1.Items.Add(document.Title)
End While



Thanks
0
Comment
Question by:bLUE
3 Comments
 
LVL 1

Accepted Solution

by:
bLUE earned 0 total points
ID: 8237375
Worked it out eventually..

        Dim document As CDocument

        For Each document In objDocuments.Values
            ListBox1.Items.Add(document.Title)
        Next
0
 
LVL 2

Expert Comment

by:rendlert07
ID: 8248111
you should be able to just say

Dim document As CDocument

       For Each document In objDocuments
           ListBox1.Items.Add(document.Title)
       Next
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9725722
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Integration Management Part 2
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question