Skip to main content

AccessTr.neT


Userform_ınitialize Sorunu

Userform_ınitialize Sorunu

#7
Hocam resmi ekledim.

[Resim: do.php?img=10228]
Cevapla
#8
Dahada yapamazsanız
Function bubble_sort(cmbo As MSForms.ComboBox)

Dim x As Integer, y As Integer

Application.ScreenUpdating = False
    With cmbo
        For x = LBound(.List) To UBound(.List)
          For y = x To UBound(.List)
                If .List(x, 0) > .List(y, 0) Then
                    temp = .List(y, 0)
                    .List(y, 0) = .List(x, 0)
                    .List(x, 0) = temp
                End If
            Next y
        Next x
    End With

Application.ScreenUpdating = True

End Function
Bu kodu ekleyin userform1e.Attaki gibide değiştirin initializeyi.

Private Sub UserForm_Initialize()

  'ComboBox3.MatchEntry = fmMatchEntryComplete
  Dim dic As Object
  Set dic = CreateObject("Scripting.Dictionary")

    For i = 7 To [d65536].End(3).Row
          dic(CStr(Cells(i, 4))) = dic(CStr(Cells(i, 4)))
    Next
ComboBox3.Clear

If dic.Count > 0 Then
    For Each Key In dic.keys
    ComboBox3.AddItem Key
   
    Next
    Call bubble_sort(Me.ComboBox3)
End If
Set dic = Nothing

'TextBox1.Text = CDate(Date) 'Form Açyly?ta otomatik tarih
ListBox1.ColumnCount = 12
ListBox1.ColumnWidths = "20;55;60;140;65;65;65;65;65;65;65;65"
ListBox1.ColumnHeads = True
ListBox1.RowSource = "A7:L" & [A65536].End(3).Row + 1

ComboBox1.RowSource = "Liste!l1:l2"
On Error Resume Next
TextBox21.Text = [e2]
TextBox22.Text = [e4]
TextBox23.Text = [e5]
TextBox60.Text = [C4]
TextBox61.Text = [C5]
TextBox29.Text = [a1]
TextBox24.Text = [G1]
TextBox25.Text = [G2]
TextBox27.Text = [G3]
TextBox63.Text = [G5]
TextBox62.Text = [I1]
TextBox64.Text = [I5]
TextBox65.Text = [K4]
TextBox95.Text = [H4]
TextBox82.Text = [I2]

'ComboBox1_Change
TextBox21 = Format(TextBox21, "#,##0.00")
TextBox22 = Format(TextBox22, "#,##0.00")
TextBox23 = Format(TextBox23, "#,##0.00")
TextBox60 = Format(TextBox60, "#,##0.00")
TextBox61 = Format(TextBox61, "#,##0.00")
TextBox24 = Format(TextBox24, "#,##0.00")
TextBox25 = Format(TextBox25, "#,##0.00")
TextBox27 = Format(TextBox27, "#,##0.00")
TextBox63 = Format(TextBox63, "#,##0.00")
TextBox62 = Format(TextBox62, "#,##0.00")
TextBox64 = Format(TextBox64, "#,##0.00")
TextBox65 = Format(TextBox65, "#,##0.00")
TextBox95 = Format(TextBox95, "#,##0.00")
TextBox82 = Format(TextBox82, "#,##0.00")
If LCase(ActiveSheet.Name) = "sayfa1" Or LCase(ActiveSheet.Name) = "liste" Or LCase(ActiveSheet.Name) = "?ABLON" Then
    ListBox1.Clear
    Exit Sub
End If
End Sub

Alttaki yeri yaptım sadece initalizede.

Kod:
Dim dic As Object
  Set dic = CreateObject("Scripting.Dictionary")

    For i = 7 To [d65536].End(3).Row
          dic(CStr(Cells(i, 4))) = dic(CStr(Cells(i, 4)))
    Next
ComboBox3.Clear

If dic.Count > 0 Then
    For Each Key In dic.keys
    ComboBox3.AddItem Key
   
    Next
    Call bubble_sort(Me.ComboBox3)
End If
Set dic = Nothing

Cevapla
#9
Hocam resimdeki kod satırı hata veriyor.

[Resim: do.php?img=10229]
Cevapla
#10
Eklememişsiniz önceden dediğimi resime bakın abey.

[Resim: do.php?img=10230]
Cevapla
#11
Haklısınız Hocam ilk kodu ekleyince sorun çözüldü.
Cevapla
#12
Bu yönetemi her yerde kullanabilirsiniz.

Normalde arraylist olanda hata vermiyor lakin sizde nasıl oldu hayret.
Cevapla

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

Yorum yapmak için üye olmanız gerekiyor

ya da
Task