# Re: 不可能

Posted by Kent on October 02, 1998 at 22:33:23:

In Reply to: 不可能 posted by 小吴 on September 21, 1998 at 07:37:13:

: 1. 动态新增非控制项阵列的控制项在 vb6 (含) 以前只能使用 API，VB6 尚不能确定。
: 2. 不管是何种版本，何种语言，都不可能达到你要的功能。

>其实vb6.0已经可以达到你要的功能了,如下
用WithEvents可以写此control的事件
Private WithEvents btnObj As CommandButton

Private Sub btnObj_Click()
MsgBox "This is a dynamically added button."
End Sub
Private Sub Form_Load()
Set btnObj = Controls.Add("VB.CommandButton", "btnObj")
With btnObj
.Visible = True
.Width = 2000
.Caption = "Hello"
.Top = 1000
.Left = 1000
End With
End Sub

Follow Ups: