CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    6

    Searching in an array?

    im searching for a suburb in an array, and i can find it and print the first home in that suburb, but i can't print the other homes, i have tryed a few statements but all i get is the same listing printed over and over, any help? thanks
    Private Sub cmdSuburb_Click()
    I = 0
    Found = False
    strSuburb = InputBox("Please enter the suburb.")
    Cls
    While (Found = False) And (I <= dblNum)
    I = I + 1
    If Trim(gSuburb(I)) = strSuburb Then
    Found = True
    End If
    Wend
    If Found Then
    Print gStreetNum(I); Tab(13); gStreetName(I); Tab(34); gSuburb(I); Tab(59); gPostalCode(I); Tab(74); gPrice(I)
    Else
    MsgBox "This suburb does not exist."
    End If

    End Sub


  2. #2
    Join Date
    Oct 2000
    Location
    Geneva / Switzerland
    Posts
    11

    Re: Searching in an array?

    Why dont you try this :

    I = 0
    Found = False
    strSuburb = InputBox("Please enter the suburb.")
    Cls
    While (I <= dblNum)
    I = I + 1
    If Trim(gSuburb(I)) = strSuburb Then
    Found = True
    Print gStreetNum(I); Tab(13); gStreetName(I); Tab(34); gSuburb(I); Tab(59); gPostalCode(I); Tab(74); gPrice(I)
    End If
    Wend
    If not Found Then
    MsgBox "This suburb does not exist."
    End If

    End Sub




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

Featured