Option Explicit
Dim WithEvents cmdDynamic As CommandButton
Private Sub Form_Load()
Set cmdDynamic = Controls.Add("vb.commandbutton", "cmdDynamic")
cmdDynamic.Width = 2000
cmdDynamic.Top = Me.Height / 2 - cmdDynamic.Height / 2 - 100
cmdDynamic.Left = Me.Width / 2 - cmdDynamic.Width / 2 - 100
cmdDynamic.Caption = "OK"
cmdDynamic.Visible = True
End Sub
Private Sub cmdDynamic_click()
MsgBox "Selamat..!! Anda telah berhasil membuat Dynamic Control", _
, "Dynamic Controls"
End Sub
Dim WithEvents cmdDynamic As CommandButton
Private Sub Form_Load()
Set cmdDynamic = Controls.Add("vb.commandbutton", "cmdDynamic")
cmdDynamic.Width = 2000
cmdDynamic.Top = Me.Height / 2 - cmdDynamic.Height / 2 - 100
cmdDynamic.Left = Me.Width / 2 - cmdDynamic.Width / 2 - 100
cmdDynamic.Caption = "OK"
cmdDynamic.Visible = True
End Sub
Private Sub cmdDynamic_click()
MsgBox "Selamat..!! Anda telah berhasil membuat Dynamic Control", _
, "Dynamic Controls"
End Sub
Sediakan sebuah form kosong, kemudian tuliskan kode di atas. Selanjutnya, JALANKAN program anda.
Selamat mencoba...!
No comments:
Post a Comment