CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2005
    Posts
    3

    Red face Showing Frames from another form in a Frame

    Hopefully this won't be confusing but I'm having a real hard time figuring this out...

    I am trying to have a Frame from another Form show in a frame in a different form..

    Example:


    Form1 has Frame1 on it

    Form2 has Frame2 on it

    Form3 has Frame3 on it

    I would like for Frame1 on Form1 to be able to show Frame2 from Form2 or Frame3 from form3..

    Basically I have 2 radio buttons on the main form (form1) the user selects radbutton1 (=true) then Frame2.visible = true inside of Fram1 (which is just a blank frame that is a place holder for the other frames)

    If a user select radbutton2 = true then I need Frame3 from Form3 to be visible in Frame1.

    I realize I could put Frames over the top of each other and make them visible and invisible in that form, but that is a pain in the ***....

    Just wondering if anyone has any ideas on how to do this in a more inelligent manner. THanks!

    GPUKILLER

  2. #2
    Join Date
    Dec 2003
    Location
    Northern Ireland
    Posts
    1,362

    Re: Showing Frames from another form in a Frame

    Think I get the jist of what your saying. Would a tabbed dialog do the job? If not, you could maybe post a screenshot of your forms.

    Check this out though,

    Hope it helps
    Attached Files Attached Files
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook


    0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010

  3. #3
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Showing Frames from another form in a Frame

    did you know that you can move controls programmatically? indeed, this is how a tabbed dialog control works

    put all your frames on the form and design them

    when the app starts up, movethem all away, eg. move them all so their left is -5000. that's 5000 twips off the left ege of the screen/form

    then when you want to activate them, move them into view. that's how a tabbed dialog control does it..

    but you'd be better off using a tab control like wizbang suggests.. he might have a name like a household cleaning chemical, but he knows his stuff!
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  4. #4
    Join Date
    Feb 2005
    Posts
    3

    Re: Showing Frames from another form in a Frame

    Unfortunetly by popular demand it has been requested to use radio buttons instead of the tabstrip. I think I figured out a different way to do this. I will simply create seperate user controls. Plop them on top of one another, and make them invisible/visible when the selects that radio button, and that will allow me work on the seperate controls away from the form. This way it's more organized, since I'll be working on the seperate controls all the time.....

  5. #5
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Showing Frames from another form in a Frame

    One question: Why would you want to put the frames on different forms?

    You can pull a control from one form onto another using the SetParent API, but positioning the control, and using the events and such would be a different matter, because vb still treats the control as being a child window of the orginal form. You can use the Container property to place controls into the frame, but it needs to already be on the form. At this point, it sounds to me that you may benefit from using a control array. Then you can use the same events for all the frames and/or controls. You can also use the ZOrder property to put a control on top of other controls which may overlap it.

    As suggested by cjard, moving the controls out of view is another way to do it. You can still use an array, and a simple loop can go through all the frames, and set them out of the way, or in view, depending on the index of the selected OptionButton. Either moving them, setting them invisible, or setting the ZOrder can work. There may be other easy ways depending on the results you are trying to achive.
    Last edited by WizBang; February 12th, 2005 at 04:15 PM.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  6. #6
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Showing Frames from another form in a Frame

    Here is an example for you to look at. I think you will see how easy it really is.
    Attached Files Attached Files
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

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

Featured