Results 1 to 3 of 3

Thread: [RESOLVED] Define Parent object of a control - Runtime

  1. #1

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Resolved [RESOLVED] Define Parent object of a control - Runtime

    Hello guys.

    My app accepts to drag a button on a frame, but the button is not in the frame. My frame is in a SSTab

    Code:
    Private Sub Frame1_DragDrop(Source As Control, x As Single, y As Single)
    Select Case Source.Name
        Case "NovoBotao":
            Set botao = Controls.Add("VB.CommandButton", "btnButtonThree")
               With botao
                  .Visible = True
                  .Width = 1000
                  .Caption = "Third Button"
                  .Top = y
                  .Left = x
                  .Parent = Me.Frame1    'this doesnt seem to work
                  
               End With
        
    End Select
    Debug.Print Source.Name
    
    End Sub
    how can I do this?

    Thank you

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Define Parent object of a control - Runtime

    set botao.container = frame1
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Re: Define Parent object of a control - Runtime

    Thank you

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