Postada em 03/09/2004 08:31 hs
Cara, eu sei que tem isso aqui no fórum, aí eu ia te passar o link. Fui lá procurar, quem falou q dá pra achar algua coisa? Tem busca por artigos e por dicas, mas não tem por projetos.
Bom, como já eu tinha copiado o exemplo, aí vai:
'Crie um form com um TextBox(Text1) e um ListBox(List1):
Option Explicit Private Const LB_FINDSTRING = &H18F Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Sub Form_Load() List1.AddItem "Banana" List1.AddItem "Laranja" List1.AddItem "Limão" List1.AddItem "Maça" List1.AddItem "Melancia" List1.AddItem "Morango" List1.AddItem "Pera" End Sub Private Sub Text1_Change() Dim pos As Long List1.ListIndex = SendMessage(List1.hWnd, LB_FINDSTRING, -1, ByVal CStr(Text1.Text)) If List1.ListIndex = -1 Then pos = Text1.SelStart Else pos = Text1.SelStart Text1.Text = List1 Text1.SelStart = pos Text1.SelLength = Len(Text1.Text) - pos End If End Sub Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer) On Error Resume Next If KeyCode = 8 Then 'Backspace If Text1.SelLength <> 0 Then Text1.Text = Mid$(Text1, 1, Text1.SelStart - 1) KeyCode = 0 End If ElseIf KeyCode = 46 Then 'Del If Text1.SelLength <> 0 And Text1.SelStart <> 0 Then Text1.Text = "" KeyCode = 0 End If End If End Sub
________________________ Té + Que NIMB role bons Dados! 
|