CONSULTA EM LISTVIEW

USUARIO.EXCLUIDOS 26/06/2004 10:24:22
#31364
PRECISO ADAPTAR ESSE CODIGO EM UMA LISTVIEW POIS ESSE CODIGO ESTà ADAPTADO EM UMA PICTURE QUE MOSTRA OS DADOS ACHADOS, SÓ“ QUE OS DADOS QUE SERà MOSTRADO EM UM LISTVIEW ESTà EM UM DB.

Private Sub cmdPesquisa_Click()
Dim Qdade As Integer
Dim Larg As Integer

Picture2.Cls
VScroll1.Value = 5

If txtPesquisa.Text = "" Then MsgBox "Nome não fornecido": txtPesquisa.SetFocus: Exit Sub
'busca por aproximação
mudNome = Trim(txtPesquisa.Text)
mudNome = "%" & mudNome & "%"
mudNome = Replace(mudNome, "%%", "%")

Call fncMudaNome

cSQL = "SELECT * FROM Authors WHERE Author LIKE '" & mudNome & "' ORDER BY Author ASC"

Me.MousePointer = 11
With DE.rsAutores
.Open cSQL, , adOpenDynamic, adLockBatchOptimistic
If .EOF Then
.Close
MsgBox "O Autor: " & vbCrLf & "' " & txtPesquisa.Text & " '" & vbCrLf & "não está cadastrado", vbInformation, "Autor não cadastrado"
Me.MousePointer = 0
txtPesquisa.SetFocus
Exit Sub
Else
Qdade = .RecordCount
' If Qdade > 120 Then
' Picture2.Height = 50000
' VScroll1.Max = Picture2.Height
' Else
' Picture2.Height = (Qdade * 200)
' VScroll1.Max = Picture2.Height
' End If
Do While Not .EOF
DoEvents
Picture2.Print ; !Au_ID; Tab(12); UCase(!Author)
.MoveNext
Loop
.Close
End If
End With
Me.MousePointer = 0
Label2.Caption = "ENCONTRADOS " & Qdade & " REGISTROS"
txtPesquisa.SetFocus
End Sub
VB6MASTER 26/06/2004 17:20:39
#31395
Resposta escolhida
Substitua a linha:
Picture2.Print ; !Au_ID; Tab(12); UCase(!Author)
por:
ListView1.AddItem !Au_ID & vbTab & UCase(!Author)
E os dados serão carregados em seu ListView e não mais no Picture.

OBS.: Só encerre o post se a resposta atender suas necessidades.

Boa sorte e t+.

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