Results 1 to 3 of 3

Thread: Adding controls at runtime

  1. #1
    jacozekk
    Guest

    Question Adding controls at runtime

    Hi there Vb-Experts!

    I have a dilly of a pickle. Im trying to add controls at runtime but I have no idea how! I've looked everywhere but so far no luck. I was wondering if you guys could help me out. Im trying to "copy and paste" a group of controls in a picture box and place them inside another picture box.

    If you guys can help me out, Id really appriciate it. Thanks!

    Eric

  2. #2
    Megatron
    Guest
    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3.     Controls.Add "VB.Label", "Label1"
    4.     Me!Label1.Move 0, 0
    5.     Me!Label1.Caption = "New label"
    6.     Me!Label1.Visible = True
    7.  
    8. End Sub

  3. #3
    Frenzied Member markman's Avatar
    Join Date
    Nov 2000
    Location
    Florida.
    Posts
    1,197
    Orrrrrrrrrr, suposing you have a command1 (it can be anything actually) with its index set to 0:
    Code:
    Load Command1(Command1.count) 'add a new command1 to the array
    Command1(command1.count-1).Left = Command1(command1.count-2).Left
    Command1(command1.count-1).Top = Command1(command1.count-2).top+Command1(command1.count-2).height   'put it under the previous one
    Command1(command1.count-1).visible = true   'nake it visible (duh!!!)
    retired member. Thanks for everything

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width