Results 1 to 3 of 3

Thread: [RESOLVED] Using User Control, Forms, Panels, Buttons, Methods, Functions + more

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2024
    Posts
    8

    Resolved [RESOLVED] Using User Control, Forms, Panels, Buttons, Methods, Functions + more

    Hi All,

    I am new to VB.NET and I am wanting the best way to setup my app.

    Like I want the app to have like a 20/80 view. On the 20, I want to have a sidebar with scroll and buttons. On the 80 side I want the buttons to populate other functions respectively.

    Are they supposed to be setup as panels for this in a User Control class? Then how do I add it to the Forms class. It seems really difficult on how it should be ran. Do I need to have separate classes for the buttons etc?

    Someone want to just give me a quick explanation, it would be greatly appreciated.

    Thanks.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,464

    Re: Using User Control, Forms, Panels, Buttons, Methods, Functions + more

    There are various ways this could be done and how you do it is up to you. You might have all the code in the one form or you might break out the functionality for each section into its own class. Which is better probably depends on how much code there is for each section.

    As for the UI, you could add all the controls to Panels on the form at design time and then simply change the visibility or z-order so the user can only see one at a time, based on which Button they click. If there are a large number of controls and that makes the UI sluggish, you might want to create multiple user controls instead. When the user clicks a Button, you can then destroy and remove the current control and then create and add a new one. Both will provide basically the same UX.

    If you go with the Panels option, be sure not to drag and drop one Panel inside another. Add them all to the form first, then use the Properties window to set the Size and Location to the same values, so they are all stacked. You can then use the Document Outline window to change the z-order to control which Panel is on top in the designer for you to work with. You can also use the drop-down at the top of the Properties window to select a Panel, then right-click the selection border and select Bring To Front.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2024
    Posts
    8

    Re: Using User Control, Forms, Panels, Buttons, Methods, Functions + more

    Quote Originally Posted by jmcilhinney View Post
    There are various ways this could be done and how you do it is up to you. You might have all the code in the one form or you might break out the functionality for each section into its own class. Which is better probably depends on how much code there is for each section.

    As for the UI, you could add all the controls to Panels on the form at design time and then simply change the visibility or z-order so the user can only see one at a time, based on which Button they click. If there are a large number of controls and that makes the UI sluggish, you might want to create multiple user controls instead. When the user clicks a Button, you can then destroy and remove the current control and then create and add a new one. Both will provide basically the same UX.

    If you go with the Panels option, be sure not to drag and drop one Panel inside another. Add them all to the form first, then use the Properties window to set the Size and Location to the same values, so they are all stacked. You can then use the Document Outline window to change the z-order to control which Panel is on top in the designer for you to work with. You can also use the drop-down at the top of the Properties window to select a Panel, then right-click the selection border and select Bring To Front.
    That was very helpful. 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