AccessTr.neT

Tam Versiyon: Kontrol Eklemek
Şu anda arşiv modunu görüntülemektesiniz. Tam versiyonu görüntülemek için buraya tıklayınız.
Sayfalar: 1 2 3
Private Sub CommandButton1_Click()
 Dim cCont As Control
 Dim strControl As String
 
 If ComboBox1.ListIndex > -1 Then
  strControl = "Forms." & ComboBox1 & ".1"
 End If
 
 Set cCont = Me.Controls.Add _
        (strControl, "CopyOf")

 
End Sub
 

Private Sub UserForm_Initialize()
With ComboBox1
        .AddItem "CheckBox"
        .AddItem "CommandButton"
        .AddItem "TextBox"
        .AddItem "ToggleButton"
    End With
End Sub
Private Sub CommandButton1_Click()
 Dim cCont As Control
 
Set cCont = Me.Controls.Add _
        ("Forms.CommandButton.1", "CopyOf")
       
    With cCont
        .Caption = "Thanks for creating me"
        .AutoSize = True
    End With
   
End Sub
Merhaba, bu yazdıklarınız örnek mi, soru mu?
Örnek kodlar
bazılarını anladım bazılarını anlamadım ama belki benden daha iyi anlayan birisi vardır diye ekledim
(12/01/2020, 08:25)accessman yazdı: [ -> ]Private Sub CommandButton1_Click()
 Dim cCont As Control
 
Set cCont = Me.Controls.Add _
        ("Forms.CommandButton.1", "CopyOf")
       
    With cCont
        .Caption = "Thanks for creating me"
        .AutoSize = True
    End With
   
End Sub

CopyOf adında bir Button ekleniyor kod ile.
Ve görünür adıda Thanks for creating me
Gifteki gibi.

[Resim: nUu7Fcj1.gif]
Sayfalar: 1 2 3