BUSCA EM LISTVIEW

USUARIO.EXCLUIDOS 01/07/2004 21:46:57
#31916
como faço para fazer funcionar a função abaixo, esqueci como.
é para efetuar uma busca no listview que mostra dados de um MDB access.
quero que essa função funcione quando der enter apos ter digitado o nome do funcionario no objeto(Text1.text) no formulario.

Function Search_Listview(LV As ListView, SearchText As String, Column As Long, Optional SelectRow As Boolean = True, Optional MakeVisible As Boolean = True) As Long
Dim SearchLength As Long
Dim CurrentRow As Long
Dim Result As Long

SearchLength = Len(SearchText)
If SearchLength = 0 Then
Search_Listview = -1
Exit Function
End If

Result = -1
SearchText = UCase$(SearchText)
If Column = 1 Then
For CurrentRow = 1 To LV.ListItems.Count
If UCase$(Left$(LV.ListItems(CurrentRow).Text, SearchLength)) = SearchText Then
Result = LV.ListItems(CurrentRow).Index
Exit For
End If
Next CurrentRow
Else
For CurrentRow = 1 To LV.ListItems.Count
If UCase$(Left$(LV.ListItems(CurrentRow).ListSubItems(Column - 1).Text, SearchLength)) = SearchText Then
Result = LV.ListItems(CurrentRow).Index
Exit For
End If
Next CurrentRow
End If
USUARIO.EXCLUIDOS 02/07/2004 07:39:08
#31931
Resposta escolhida
Será que é algo parecido com isso que você quer?

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Search_Listview...
End Sub


Espero ter ajudado
Tópico encerrado , respostas não são mais permitidas