Results 1 to 6 of 6

Thread: [RESOLVED] Form layout. Posible ideas or help with table layout.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    70

    Resolved [RESOLVED] Form layout. Posible ideas or help with table layout.

    I am working on a project that is going to connect to a SQL database. I would like to design this project using something similar to the iFrame control used in HTML. I have a basic form with 7 buttons.



    I would like to have the new forms open in the blank space to the right of the button instead of a new window. How is the best way to do that? Thanks for any ideas.

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,430

    Re: Form layout. Posible ideas or help with table layout.

    Do you actually want forms to appear in that area or just collections of controls?

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    70

    Re: Form layout. Posible ideas or help with table layout.

    I suppose just the controls would be fine.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    70

    Re: Form layout. Posible ideas or help with table layout.

    I know I can use the buttons to hide and unhide the controls but I was looking for a way to avoid putting controls on top of other controls.

  5. #5
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    105,430

    Re: Form layout. Posible ideas or help with table layout.

    Quote Originally Posted by mulefeathers View Post
    I know I can use the buttons to hide and unhide the controls but I was looking for a way to avoid putting controls on top of other controls.
    Putting controls on top of other controls is only a problem if you have a very large number of them, which might cause performance issues. Otherwise, what's the big deal?

    I would suggest that you create a user control for each set of controls you want to display, which presumably means one per Button on that form. If you aren't already aware, you add a user control to your project much as you do a form and you design and code it the same way too. Once you build your project, the UC will be added to the Toolbox and you can then treat it like you would any other control.

    Once all your UCs exist, you can either add them all together in the designer or else create and destroy them in code. I would tend to go for the first option. It will work best if they are all the same size. You can add each one to the form and then set their Location properties to the same value. You will then only be able to see one of them at a time, both at design time and run time. At design time, you can right-click on the one you can see and select Send To Back to reveal the next one in the stack. You can also use the Document Outline window or the drop-down at the top of the Properties window to select the one you want, then right-click the selection rectangle and select Bring To Front to expose that particular control. At run time, you simply call BringToFront on the control you want the user to see and that will obscure all the others.

    If you want to take the create-and-destroy option, each time the user clicks a Button you would call Dispose on the currently displayed UC, which will also remove it from the form, and then you would create a new instance of the control you want to display, configure it and then Add it to the form's Controls collection.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2009
    Posts
    70

    Re: Form layout. Posible ideas or help with table layout.

    Fantastic. This is perfect.

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