Click to See Complete Forum and Search --> : Type Mismath


Detard
January 27th, 2000, 12:58 PM
Can anyone tell me why this code is giving my a type mismatch error?
[vbcode]
Public Function qualitylook()
Dim n As Integer
Dim Qual As String

For n = 0 To lstFoundBrit.ListCount
Qual = lstFoundBrit.List(n)
lstFoundBrit.ListIndex = 0
If Left(Qual, 2) <> 1 Then
lstFoundBrit.RemoveItem (lstFoundBrit.List(lstFoundBrit.ListIndex))
End If
Next n
End Function


Thanx for the help,
Detard

Detard
January 27th, 2000, 12:58 PM
Can anyone tell me why this code is giving my a type mismatch error?
[vbcode]
Public Function qualitylook()
Dim n As Integer
Dim Qual As String

For n = 0 To lstFoundBrit.ListCount
Qual = lstFoundBrit.List(n)
lstFoundBrit.ListIndex = 0
If Left(Qual, 2) <> 1 Then
lstFoundBrit.RemoveItem (lstFoundBrit.List(lstFoundBrit.ListIndex))
End If
Next n
End Function


Thanx for the help,
Detard

JimmyT
January 27th, 2000, 07:36 PM
If you are declaring this as a function, it must return a value. The code snippet you have provided should be called a Sub vice a function because it does not return a value.

Lothar Haensler
January 28th, 2000, 04:17 AM
>lstFoundBrit.RemoveItem (lstFoundBrit.List(lstFoundBrit.ListIndex))


Looks wrong to me:
removeItem takes an integer, .List returns a string.