Originariamente inviato da vr-claudio
Nel evento_LostFocus della casella ho scritto:
List1.ListIndex = SendMessage(List1.hwnd, LB_FINDSTRINGEXACT, -1, ByVal CStr(Text.Text))
E nel pulsante salva_click ho scritto in questo modo:
If Text.Text = List1.Text Then
MsgBox "Il seguente contatto è già presente nel Database!", vbCritical
Else
...
End If
In realtà puoi scrivere direttamente così, nell'evento LostFocus:
codice:
Dim retval As Long
retval = SendMessage(List1.hwnd, LB_FINDSTRINGEXACT, -1, ByVal CStr(Text.Text))
If retval >-1 Then
MsgBox "Il seguente contatto è già presente nel Database!", vbCritical
End If
Boolean