Kontrol Eklemek

1 2 3
12/01/2020, 08:23

accessman

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
12/01/2020, 08:25

accessman

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
17/01/2020, 15:27

ozanakkaya

Merhaba, bu yazdıklarınız örnek mi, soru mu?
17/01/2020, 15:35

accessman

Örnek kodlar
bazılarını anladım bazılarını anlamadım ama belki benden daha iyi anlayan birisi vardır diye ekledim
17/01/2020, 22:20

feraz

(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
17/01/2020, 22:25

feraz

Gifteki gibi.


1 2 3