469,090 Members | 1,296 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

allowing the user to add a command button

hello, I am an extreme novice and was wondering if anyone has an answer for me I cant seem to find in any of my books.

what I want to do:

-Allow the user to Name and create his/her own command buttons within the application

My question is what lines of code do you think I would find helpful?

to be more specific:

I have an "OK" button on one form, I want the action of this button to be "create another command button on a ANOTHER form that the user can drag around that performs a totally separte action (which is add some numbers together)

If you need any more specifics post and Ill give more detail, thanks for reading
Nov 12 '06 #1
2 1625
albertw
267 100+
hi

i know how to create another object on the same form.
try this
note that you can only use it once, or you need to change the commandbutton's name !

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim ctlName As Control
  3. Set ctlName = frmMain.Controls.Add("VB.CommandButton", "Command2", Form1)
  4. With ctlName
  5. .Visible = True
  6. .Caption = "New button"
  7. .Move 400, 400, 1400, 480
  8. End With
  9.  
  10.  
Nov 12 '06 #2
albertw
267 100+
hi

i know how to create another object on the same form.
try this
note that you can only use it once, or you need to change the commandbutton's name !

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim ctlName As Control
  3. Set ctlName = frmMain.Controls.Add("VB.CommandButton", "Command2", Form1)
  4. With ctlName
  5. .Visible = True
  6. .Caption = "New button"
  7. .Move 400, 400, 1400, 480
  8. End With
  9.  
  10.  
hi another thing
if you create a new button, there is no code behind it, so you can't expect any action when pressed.

might be better if you pre-created a non visible button (with code) and make it visible
Nov 13 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by David J Rose | last post: by
1 post views Thread by Mphoza | last post: by
6 posts views Thread by Jim | last post: by
2 posts views Thread by mikeingenito | last post: by
reply views Thread by mk397 | last post: by
3 posts views Thread by marsguy85 | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.