فائدة: البحث في ال ComboBox و ال ListBox
سؤال يكثر طرحة عن كيفية البحث في ال ComboBox و ال ListBox الكود المرفق يبين كيفية فعل ذلك ، و بامكانك سحب المثال
code
Function FindInCombo(TheCombo As ComboBox, FindIt As String) As Integer
Dim i As Integer
For i = 0 To TheCombo.ListCount - 1
If UCase(TheCombo.List(i)) Like UCase(FindIt) & "*" Then
FindInCombo = i
Exit For
End If
Next i
End Function
Function FindInList(TheList As ListBox, FindIt As String) As Integer
Dim i As Integer
For i = 0 To TheList.ListCount - 1
If UCase(TheList.List(i)) Like UCase(FindIt) & "*" Then
FindInList = i
Exit For
End If
Next i
End Function
Private Sub Command1_Click()
Combo1.ListIndex = FindInCombo(Combo1, ****1.****)
List1.ListIndex = FindInList(List1, ****1.****)
End Sub
Private Sub ****1_Change()
Combo1.ListIndex = FindInCombo(Combo1, ****1.****)
List1.ListIndex = FindInList(List1, ****1.****)
End Sub
املف
هذا و الله اعلم
تحيات اختكم
دمعة فرح