Results 1 to 14 of 14

Thread: [RESOLVED] [2005] Multiple Panels instead of Forms

  1. #1

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Resolved [RESOLVED] [2005] Multiple Panels instead of Forms

    To save from using several different forms in programs. I'd like to make just a few panels to represent each one. Then when I need to display one I just set it to visible or not visible.

    For example, a quiz program. The 1st 10 questions are on one panel, the 2nd 10 are on a 2nd panel. They are both identical except different questions.

    The problem is, when I try to put them both on the form, they have to be in different areas or else one will go inside the other. How can I keep several panels on one form without them going inside each other, in other words how can I keep them separate?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391

    Re: [2005] Multiple Panels instead of Forms

    You could just keep them small and then resize at runtime.

  3. #3

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: [2005] Multiple Panels instead of Forms

    That would sort of work, but I was wondering if there was a more direct way to just keep the panels separate. Like some kind of setting to block one panel from being placed in another.

    If I did do the resize thing it would make editing the panels take longer.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2005] Multiple Panels instead of Forms

    I don't think the IDE has a way of preventing that. I played around with locking controls, but that didn't seem to help.

  5. #5

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: [2005] Multiple Panels instead of Forms

    Quote Originally Posted by Negative0
    I don't think the IDE has a way of preventing that. I played around with locking controls, but that didn't seem to help.
    Well perhaps the solution doesn't have to be using Panels. Really I just want a way to do something like that. For instance I may be able to use the tab panel control, I just need a way to hide the tabs at the top and then it's nearly the same concept I'm looking for.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  6. #6
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391

    Re: [2005] Multiple Panels instead of Forms

    Okay, I just tried it and I was able to place one panel on top of the other when I lined it up in the top-left corner so that they were directly on top of one another. You can tell when the little rectangle indicating that you'll be adding the panel as a child of the one beneath disappears.

  7. #7
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391

    Re: [2005] Multiple Panels instead of Forms

    Multiple panels aside, if they are identical is there any reason to not just use one panel and update the questions when switching between the two?

  8. #8

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: [2005] Multiple Panels instead of Forms

    Quote Originally Posted by wy125
    Multiple panels aside, if they are identical is there any reason to not just use one panel and update the questions when switching between the two?
    In my example no, but that was just an example. I have had cases where I wanted to use the same-sized form but had different content on the panels. But if it was a quiz form you are correct.

    I can try lining up the panels, but to edit one I will have to move it and in doing that it may go back inside. I'll have to see if dragging it out just enough to line up with the others will pull it out again (which is what I want).

    EDIT: Ya it works! Even if I first place one panel in another, just dragging it out to line up with it will pull it out from the previous one. Thanks for solving that!
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  9. #9
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,038

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    Here's another solution: Place the panels wherever you want during design time, and don't use Hide/Unhide to show them. For PDA programs, forms take significant time to load, so I use lots of panels on a single form rather than lots of forms. I set the Left property of each panel correctly in the form Load event, but set the Top property to a number so high that the panel is off the bottom of the screen. Whenever I want to display a panel, I change the Top property to 0 (or whatever would be appropriate in your case). Since I am setting the Left property in the Load, and the Top property here and there, where the panels are located at design time is irrelevant, since they will be moved into place at runtime.

    I have more discussion of that technique in the Mobile Development section of the forum, though I haven't laid it out thoroughly in a couple years, so the threads that hold the info are a bit old.
    My usual boring signature: Nothing

  10. #10

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    I thought of that but you would have to put the panels side-by-side in Design Mode otherwise one would go inside the other. Then to edit you would have to make your form larger than you wanted. Unless when you change the position of one that is inside the other during run-time will actually pull it out, I don't think that would work as if a panel inside another is moved outside the bounds of the first one, it will simply appear as invisible.
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  11. #11
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,038

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    They don't have to be side-by side, they just wouldn't be able to overlap exactly. As long as they are only partial overlaps they work fine.

    Sounds like you have it solved, though.
    My usual boring signature: Nothing

  12. #12

    Thread Starter
    Fanatic Member Vectris's Avatar
    Join Date
    Dec 2008
    Location
    USA
    Posts
    941

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    Quote Originally Posted by Shaggy Hiker
    They don't have to be side-by side, they just wouldn't be able to overlap exactly. As long as they are only partial overlaps they work fine.

    Sounds like you have it solved, though.
    Well I think I will use the other way, but I'm interested in hearing any other possibility. If they overlapped, wouldn't it just put it inside the other? How can you overlap them while keeping them separate? That's like going back to my first question, asking how you did that. Is there something about overlapping causing one to go into the other that I'm overlooking? (I don't mean any of that to sound rude if it does, I'm just not seeing it).
    If your problem is solved, click the Thread Tools button at the top and mark your topic as Resolved!

    If someone helped you out, click the button on their post and leave them a comment to let them know they did a good job

    __________________
    My Vb.Net CodeBank Submissions:
    Microsoft Calculator Clone
    Custom TextBox Restrictions
    Get the Text inbetween HTML Tags (or two words)

  13. #13
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,038

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    I had no problem overlapping them during design, though I do seem to remember that if they overlapped too much they would embed rather than overlap. I had a couple that I was working on, then have the rest in a heap. The form was as large as I could make it, though. The form can be resized when run, but for a PDA there was no advantage to resizing the form, as I just wanted a form that was at least bigger than the screen size, if not even larger.
    My usual boring signature: Nothing

  14. #14
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [RESOLVED] [2005] Multiple Panels instead of Forms

    Have a look here:
    http://www.vbforums.com/showthread.php?t=558143

    Or here (same thing):
    http://dotnetrix.co.uk/custom.htm


    It's a "PanelManager" control that allows you to add/remove panels like you can with a TabControl. You can use the SelectedPanel property to switch the right panel to the front. All that is done internally, so you don't need to worry about positioning, making them visible etc...

    It was also the basis for my WizardControl (see signature).

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