Results 1 to 6 of 6

Thread: Moving controls into Picturebox

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    14

    Moving controls into Picturebox

    VB5: How do I move a textbox and a command button into a picturebox.

    Also, can I duplicate the picturebox, including these controls?

    THANK YOU !!!!

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Moving controls into Picturebox

    Quote Originally Posted by DennisTheVB
    VB5: How do I move a textbox and a command button into a picturebox.
    Not sure about VB5 but in VB6 you can set the objects .Container property....

    Code:
    Private Sub Command1_Click()
        Set Text1.Container = Picture1 ' Put Text1 into Picture1 
        Text1.Move 10,10                ' move to position 10,10
        Set Command1.Container = Picture1
        Command1.Move Text1.Width + 100, 10
    End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    14

    Re: Moving controls into Picturebox

    Thank you, thank you and thank you again !!!

  4. #4
    Member
    Join Date
    Aug 2008
    Location
    New Zealand
    Posts
    62

    Re: Moving controls into Picturebox

    Very nice code

    Do you know how to do it with another form becuase I tried but I got an error?

  5. #5
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Moving controls into Picturebox

    Quote Originally Posted by MongooseRoadkill
    Very nice code

    Do you know how to do it with another form becuase I tried but I got an error?
    I don't think VB has a built in function to do that, you probably need to use the SetParent API.

    I think this example does that, Reparent controls from one form to another.

  6. #6
    Member
    Join Date
    Aug 2008
    Location
    New Zealand
    Posts
    62

    Re: Moving controls into Picturebox

    I've got it working now thanks

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