Serious Help Needed... Comparing ArrayLists or Listboxes

werdmaus

New member
Joined
Dec 15, 2004
Messages
1
Programming Experience
Beginner
Hello:

I have a windows application that takes 2 .txt files and loads them into 2 seperate arraylists. There is a common link between the .txt files. That link is that I need to match the phone # and data from 1.txt with the same phone # and data from 2.txt...

Example:

1.txt
-----------
Dave
123 Bird St.
(216) 123-4567

Tom
456 Day St.
(440) 333-4587

2.txt
------------
ABC, Inc
Sales
(440) 459-7895

XYZ, Inc
Materials
(216) 123-4567

The program needs to realize that the Phone # with Dave, matches the Phone # with XYZ, Inc. and combine the data together to get

Dave
123 Bird St.
(216)123-4567
XYZ, Inc
Materials


This is like using the phone # as a primary key with a database only I have to use the .txt files and arraylists.


Source Code Below
=====================================================
Public Sub LoadCustomer()
Dim objReader As New StreamReader("c:\myCustomers.txt")
Dim sLine As String = ""
Dim People As New ArrayList

Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
People.Add(sLine)
End If
Loop Until sLine Is Nothing
objReader.Close()
For Each sLine In People
ListBox1.Items.Add(sLine)
Next

End Sub
Public Sub LoadBoat()
Dim objReader As New StreamReader("c:\myBoats.txt")
Dim sLine As String = ""
Dim Boats As New ArrayList
Do
sLine = objReader.ReadLine()
If Not sLine Is Nothing Then
Boats.Add(sLine)
End If
Loop Until sLine Is Nothing
objReader.Close()
For Each sLine In Boats
ListBox2.Items.Add(sLine)
Next


End Sub

=======================================================

Any help would be greatly appreciated...
 
Back
Top