Skip to main content

AccessTr.neT


Birbirine Bağlı Listbox

Birbirine Bağlı Listbox

#2
Merhaba.Müsait olsunca kodları kısaltırım bir sub içine alıp.

[Resim: do.php?img=10962]

Private Sub ListBox1_Click()

    Dim dic As Object, veri, aranan As String
   
    Set dic = CreateObject("Scripting.dictionary")
    With Sayfa2
        veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
        For i = LBound(veri) To UBound(veri)
            aranan = veri(i, 2)
            If veri(i, 1) = ListBox1.Value Then
                If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
            End If
        Next
    End With
    With ListBox2
    .Clear
    ListBox3.Clear
    .List = dic.keys
    End With
    Set dic = Nothing: Erase veri
End Sub


Private Sub ListBox2_Click()
    Dim dic As Object, veri, aranan As String
    If ListBox1.ListIndex = -1 Then
   
        ListBox3.Clear
        Exit Sub
    End If
    Set dic = CreateObject("Scripting.dictionary")
    With Sayfa2
        veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
        For i = LBound(veri) To UBound(veri)
            aranan = veri(i, 3)
            If veri(i, 1) & "|" & veri(i, 2) = ListBox1.Value & "|" & ListBox2.Value Then
                If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
            End If
        Next
    End With
    With ListBox3
    .Clear
    .List = dic.keys
    End With
    Set dic = Nothing: Erase veri
End Sub

Private Sub TextBox1_Change()
    Dim dic As Object, veri, aranan As String
   
    Set dic = CreateObject("Scripting.dictionary")
    With Sayfa2
        veri = .Range("A2:A" & .Range("A" & Rows.Count).End(3).Row).Value
        For i = LBound(veri) To UBound(veri)
            aranan = veri(i, 1)
'          If LCase(veri(i, 1)) Like "*" & LCase(TextBox1.Value) & "*" Then 'icerik arama
          If LCase(veri(i, 1)) Like LCase(TextBox1.Value) & "*" Then 'bastan arama
                If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
          End If
        Next
    End With
    With ListBox1
    .Clear
    .List = dic.keys
    End With
    Set dic = Nothing: Erase veri
End Sub

Private Sub UserForm_Initialize()
    Dim dic As Object, veri, aranan As String
   
    Set dic = CreateObject("Scripting.dictionary")
    With Sayfa2
        veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
        For i = LBound(veri) To UBound(veri)
            aranan = veri(i, 1)
            If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
        Next
    End With
    With ListBox1
    .Clear
    .List = dic.keys
    End With
    Set dic = Nothing: Erase veri
    TextBox1.SetFocus
End Sub
.rar Kitap11.rar (Dosya Boyutu: 1,96 MB | İndirme Sayısı: 5)
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Birbirine Bağlı Listbox - Yazar: malatyalı - 26/04/2021, 15:32
RE: Birbirine Bağlı Listbox - Yazar: feraz - 27/04/2021, 01:44
RE: Birbirine Bağlı Listbox - Yazar: malatyalı - 27/04/2021, 07:36
RE: Birbirine Bağlı Listbox - Yazar: feraz - 27/04/2021, 07:40
RE: Birbirine Bağlı Listbox - Yazar: feraz - 27/04/2021, 17:01
RE: Birbirine Bağlı Listbox - Yazar: malatyalı - 27/04/2021, 17:33
Re: Birbirine Bağlı Listbox - Yazar: feraz - 27/04/2021, 18:18
RE: Birbirine Bağlı Listbox - Yazar: malatyalı - 27/04/2021, 18:39
Task