COMBO

USUARIO.EXCLUIDOS 04/05/2005 12:19:53
#81568
Como fazer para que quando estiver sendo digitado os dados em um combo seja completado.
Ex: No Combo tem a palavra Frase, então quando digitar F ele complete o restante.

Valews
JEAN.JEDSON 04/05/2005 13:06:27
#81579
tente com este exemplo...

http://www.vbmania.com.br/vbmdetail.php?varID=2847
USUARIO.EXCLUIDOS 04/05/2005 14:02:39
#81591
Coloque este código em um módulo:


Sub AutoProcura(cbo As ComboBox, KeyAscii As Integer)

Dim sBuffer As String
Dim lRetVal As Long
sBuffer = Left(cbo.Text, cbo.SelStart) & Chr(KeyAscii)
lRetVal = SendMessage((cbo.hWnd), CB_FINDSTRING, -1, ByVal sBuffer)
If lRetVal <> CB_ERR Then
cbo.ListIndex = lRetVal
cbo.Text = cbo.List(lRetVal)
cbo.SelStart = Len(sBuffer)
cbo.SelLength = Len(cbo.Text)
KeyAscii = 0
End If

End Sub


Carregue a combo usando o o ADDITEM.


Combo1.AddItem "Teste1"
Combo1.AddItem "Teste2"
Combo1.AddItem "Teste3"


Coloque este código do KEYPRESS da Combo:

AutoProcura Combo1, KeyAscii


e pronto!!!
USUARIO.EXCLUIDOS 04/05/2005 14:04:32
#81592
Coloque este código em um módulo:


Sub AutoProcura(cbo As ComboBox, KeyAscii As Integer)

Dim sBuffer As String
Dim lRetVal As Long
sBuffer = Left(cbo.Text, cbo.SelStart) & Chr(KeyAscii)
lRetVal = SendMessage((cbo.hWnd), CB_FINDSTRING, -1, ByVal sBuffer)
If lRetVal <> CB_ERR Then
cbo.ListIndex = lRetVal
cbo.Text = cbo.List(lRetVal)
cbo.SelStart = Len(sBuffer)
cbo.SelLength = Len(cbo.Text)
KeyAscii = 0
End If

End Sub


Carregue a combo usando o o ADDITEM.


Combo1.AddItem "Teste1"
Combo1.AddItem "Teste2"
Combo1.AddItem "Teste3"


Coloque este código do KEYPRESS da Combo:

AutoProcura Combo1, KeyAscii


e pronto!!!
JEAN.JEDSON 07/07/2005 17:55:08
#92788
seu problema foi resolvido?
Tópico encerrado , respostas não são mais permitidas