Results 1 to 2 of 2

Thread: [RESOLVED] [2005] Nested Loop problem

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2007
    Posts
    22

    Resolved [RESOLVED] [2005] Nested Loop problem

    The Program has two files USpres.txt, and usSenate, the program needs to display all presidents that served in the US.Senate. The problem is fixed with the code below. Thanks

    Code:
    Public Class frmUSPRES
        Dim strUSPres, strUSSenate As String
        Private Sub btnCompute_Click(ByVal sender As System.Object, _
                    ByVal e As System.EventArgs) Handles btnCompute.Click
    
            Dim sr1 As IO.StreamReader = IO.File.OpenText("uspres.txt")
            Do While sr1.Peek <> -1
                strUSPres = sr1.ReadLine
                Dim sr2 As IO.StreamReader = IO.File.OpenText("ussenate.txt")
                Do While sr2.Peek <> -1
                    strUSSenate = sr2.ReadLine
                    If strUSPres = strUSSenate Then
                        strUSPres = strUSSenate
                        lstOutput.Items.Add(strUSPres)
                    End If
                Loop
            Loop
    Last edited by peterdfl; May 10th, 2007 at 09:02 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