Results 1 to 5 of 5

Thread: [2005] loop through arraylist [resolved]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Austin
    Posts
    397

    [2005] loop through arraylist [resolved]

    this should be simple enough... what is the correct way to loop through an arraylist?

    Code:
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim CorpGroups As ArrayList = Groups.GetGroupNums
    
            PrintValues(CorpGroups)
    
            With Me.DataGridView1
                .DataSource = CorpGroups
            End With
    
        End Sub
    
        Public Shared Sub PrintValues(ByVal myList As IEnumerable)
            Dim myEnumerator As System.Collections.IEnumerator = myList.GetEnumerator()
    
            While myEnumerator.MoveNext()
                Console.Write(ControlChars.Tab + "{0}", myEnumerator.Current)
            End While
    
            Console.WriteLine()
    
        End Sub

    Console.Write outputs this:
    GroupReportsFolderCreator.Groups

    but the GridView has the correct info:
    Code:
    corp_num  group_num
    123            1586
    123            1587
    Last edited by texas; Jul 12th, 2006 at 10:13 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width