SABER SE O NOME ESTA NO COMBO
Pessoal como saber por exemplo se a maquina MAQ001 esta na relacionada no combo, pois preciso fazer o seguinte se a maquina X estiver logada na rede me mostra uma imagem se nao tiver mostra outra.
SE VC quiser saber se um determinado texto está num combo, o código seria mais ou menos assim:
for i=0 to combo.listcount-1
if trim(texto) = trim(combo.list(i)) then
msgbox"Achou"
endif
next i
Use essa Função
Public Function Verificar (Byval Nome as string) as boolean
dim i%
Verificar = false
for i = 0 to combo.listcount-1
if Nome = combo.list(i) then
Verificar = True
exit for
endif
next
end if
Abraços
Public Function Verificar (Byval Nome as string) as boolean
dim i%
Verificar = false
for i = 0 to combo.listcount-1
if Nome = combo.list(i) then
Verificar = True
exit for
endif
next
end if
Abraços
Use essa Função
Public Function Verificar (Byval Nome as string) as boolean
dim i%
Verificar = false
for i = 0 to combo.listcount-1
if Nome = combo.list(i) then
Verificar = True
exit for
endif
next
end if
Abraços
Public Function Verificar (Byval Nome as string) as boolean
dim i%
Verificar = false
for i = 0 to combo.listcount-1
if Nome = combo.list(i) then
Verificar = True
exit for
endif
next
end if
Abraços
Usando API:
A sintaxe é (com Combo1):
Se o item estiver relacionado, vai retornar o indice do mesmo, caso contrário, retorna -1.
Private Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
Const WM_USER = &H400
Const CB_FINDSTRING = (WM_USER + 12)A sintaxe é (com Combo1):
Dim FindString As String
FindString = "Blah"
CB = SendMessage(Combo1.hWnd, CB_FINDSTRING, -1, ByVal FindString)Se o item estiver relacionado, vai retornar o indice do mesmo, caso contrário, retorna -1.
Tópico encerrado , respostas não são mais permitidas