Results 1 to 4 of 4

Thread: Loading option buttons at runtime

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Location
    Los Angeles
    Posts
    126

    Loading option buttons at runtime

    Hi everyone,
    I am using this code to load 5 frames at form load. I need to load 2 option buttons into each frame. I can get an option button to load on the form, but not be contained in the frame(s). Is it possible?
    On the form, I have a frame with Index set to 0 and 2 option buttons, each named Option1 with indexes of of 0 and 1.
    Code:
    Dim i As Integer
    
         For i = 1 To 5
              Load Frame1(i)
                   With Frame1(i)
                     .Top = Frame1(i - 1).Top + _
                        Frame1(i - 1).Height + 10
                     .Visible = True
                     .Caption = "Frame" & (i + 1)
                   End With
         Next i
    Thanks,
    Michael

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Use the SetParent API to make the frame the owner. It'll then be in it, and there's no chance of escape!

    Public Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

    There's the declare.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2003
    Location
    Los Angeles
    Posts
    126
    Darn ...
    Now I am forced to learn programming to the API! I knew it was going to happen soon, but did not want that time to be today.
    Thanks
    Digital

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111
    Originally posted by IGBP
    Darn ...
    Now I am forced to learn programming to the API! I knew it was going to happen soon, but did not want that time to be today.
    Thanks
    Digital
    SetParent Option1.hwnd, Frame1.hwnd

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