|
-
Oct 5th, 2000, 05:27 PM
#1
Thread Starter
New Member
I am trying to load into a collection the key and member from a file. When I run the program I get "Key already associated error" any suggestions on this code?
Private Sub Form_Load()
Dim mcollTerms As New Collection
Dim strTerms As String 'key
Dim strDefine As String 'member
Dim j As Integer
Dim Temp As String
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Open "a:\computerTerms.gls" For Input As #1
Dim obj As Variant
For Each obj In mcollTerms
mcollTerms.Remove 1
Next obj
Do While Not EOF(1)
mcollTerms.Add strDefine, strTerms
lstTerms.AddItem strTerms
Loop
lstTerms.ListIndex = 1
Close #1
Thanks
Kelly
-
Oct 5th, 2000, 06:05 PM
#2
_______
<?>
You forgot you input from your file:
Do While Not EOF(1)
Input #1, strDefine, strTerms 'get the stuff from file
mcollTerms.Add strDefine, strTerms
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 5th, 2000, 08:13 PM
#3
Thread Starter
New Member
still getting error:
Open "a:\computerTerms.gls" For Input As #1
Dim obj As Variant
For Each obj In mcollTerms
mcollTerms.Remove 1
Next obj
Do While Not EOF(1)
Input #1, strDefine, strTerms
mcollTerms.Add strDefine, strTerms ('error here already associated key)
lstTerms.AddItem strTerms
Loop
lstTerms.ListIndex = 1
Close #1
-
Oct 5th, 2000, 08:24 PM
#4
Thread Starter
New Member
thanks HeSaidJoe
there was some other syntex probs. but got it reading and inputting the file. All I need to do now is code my click event in the list box to pull up the member that goes with the key.
Thaks agian
Kelly
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|