|
-
Nov 16th, 1999, 03:09 AM
#1
Thread Starter
Hyperactive Member
Ok what am i doing wrong? I have a listbox which I add words to but the problem is if the word is in the list I want a message box to say its in the list. That part works the problem is if it is not in the list a get a run time error 380 invalid property value. I know it is in my for next loop but and the counter part but can't seem to get it right!
Here is my code maybe some one can figure out what is wrong Thanks Troy
Private Sub CmdAdd_Click()
Dim FileNumber
Dim NewWord As String
Dim CheckWord As Integer
FileNumber = FreeFile
'Open App.Path & "\ana.txt" For Append As #FileNumber
NewWord = TxtWord.Text
For I = 1 To LstWord.ListCount
I = I + 1
LstWord.ListIndex = I
Counter = Counter + 1
inlist = LstWord.Text
If inlist = NewWord Then
MsgBox "This word " & NewWord & " is already in the list"
TxtWord.Text = ""
TxtWord.SetFocus
Exit Sub
Else
If Counter = LstWord.ListCount Then
Open App.Path & "\ana.txt" For Append As #FileNumber
Print #FileNumber, NewWord
LstWord.AddItem NewWord
TxtWord = ""
TxtWord.SetFocus
Close #FileNumber
End If
End If
Next
End Sub
------------------
Troy MacPherson
Customer Suport Software Analyst
[email protected]
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
|