Private WithEvents Ctl_Button As CommandButton



For i = 1 To 6
CtlName = "Button" & i
Set Ctl_Button = Me.Controls.Add("VB.CommandButton", CtlName)
With Ctl_Button

.Move 2000, 880 + j, 5242, 395
.Caption = CtlName
.Visible = True
End With
j = j + 400
Next


Using this I am creating 6 command buttons at runtime , Now My problem is only the last button's events works the rest remain just controls with now events , I hope that it requires a API function to be written on mouseup event , Please do help me