Results 1 to 2 of 2

Thread: Setting controls into another container in a usercontrol [Resolved]

  1. #1

    Thread Starter
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575

    Resolved Setting controls into another container in a usercontrol [Resolved]

    I have a usercontrol with a picture box in it. The usercontrol has the controlcontainer set to true. I am trying to get the code so that when a user places a control into the usercontrol, the usercontrol will put that control into the picture1 container

    Then I need to loop around the picture1 contained controls and move them about.

    I have tried this code:
    Code:
    Dim itm As Control
    For Each itm In ContainedControls
        
        'Set itm.Container = Picture1 ‘this doesn’t work at all – I need to use setparent - don't know why
        SetParent itm.hWnd, Picture1.hWnd
    Next
    
    For Each itm In Controls
        If itm.Container Is Picture1 Then 
            Debug.Print itm.Name ‘The code never gets in here
        Else
            Debug.Print "not " & itm.Name
        End If
    Next
    Anyone know how to do this properly

    Cheers

    Rob
    Last edited by THEROB; Oct 7th, 2004 at 06:16 AM.
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

  2. #2

    Thread Starter
    Fanatic Member THEROB's Avatar
    Join Date
    Oct 2000
    Location
    I'm cold and there are wolves after me
    Posts
    575
    I solved the problem by adding controls to a collection - then looping around the collection and setting the values there.

    If it is to be it is up to me
    My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]

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