Visual c# form design - Best practices

I have a windows forms application (microsoft visual c# 2005) that accesses mysql database to display, enter or modify data. The main form has the menu on the left side where the user selects from a list of choices. When a user makes a selection, info (text boxes, etc) is displayed on the right side. The question is: what is the proper container to use for the right side? I am currently using custom controls for each of the menu options. Is there a better way to implement this? What are you all using in such situations? Any Advice?

Thanks
panayotiAsked:
Who is Participating?
 
DonKylesConnect With a Mentor Commented:
I use asp:Panel...why?  because I can set the focus to the field I want when the user click from the menu. I also can set the default button for each panel.
example.

menu 1  ----- onclick visible pnlMenu1 invisible pnlMenu2 and pnlMenu3
menu 2  ----- onclick visible pnlMenu2 invisible pnlMenu1 and pnlMenu3
menu 3  ----- onclick visible pnlMenu3 invisible pnlMenu1 and pnlMenu2

<asp:Panel ID="pnlMenu1" DefaultButton="btnAdd" visible="false">....</asp:Panel>
<asp:Panel ID="pnlMenu2" DefaultButton="btnUpdate" visible="false">....</asp:Panel>
<asp:Panel ID="pnlMenu3" DefaultButton="btnDelete" visible="false">....</asp:Panel>

By this way, you can do anything in a single page.
0
 
angus_young_acdcConnect With a Mentor Commented:
It's rather difficult to say, most people have different practices for everything.  For example when using a button I would name it btnName, and others prefer things like btn_Name / Name_btn etc.  

For your needs I would most likely go for Splitter or SplitContainer.  Depending on how much information, and how big you want the menu etc to be.  A SplitContainer would be good as objects are only shown in that specific Panel, they are not spread across the two areas.
0
 
DonKylesConnect With a Mentor Commented:
Or if you are using ASP.NET 2.0, you can use MasterPage to hold the menu. When you create a new webform you just select the MasterPage without copy the code from another file. And all the page will be the same layout/style/format.... MasterPage is like Header and Footer that you insert at the beginning and the ending of the html code. This might be a best practice for Menu and the layout of the page.  The menu will be the hyper link to link to the appropriate page. For example,

---------------------------------------------------------------------------------------------------------------------
                                             Header/Title
---------------------------------------------------------------------------------------------------------------------
Home        |  Home :: Add Form
add           |     i-------------------------------------------------------------------------------------------------|
edit           |     |                                                                                                                         |
delete        |    |                                            Add Form                                                                |
view          |    |______________________________________________________________________|
                |
                |
----------------------------------------------------------------------------------------------------------------------
                                           footer
----------------------------------------------------------------------------------------------------------------------
0
 
panayotiAuthor Commented:
Thank you all for your suggestions:

I did not mention that my application is not asp based.

Is asp Panel indicative for a windows desktop application? Setting the panels to invisible, system resources won't be released which will result in poor performance as the number of panels increases. How do I design my panels at design time? Recall that each panel will have a number of other controls (dataGridView, textboxes, buttons, tab controls, binding navigators, etc).

Regarding the other option, use of split container, I am using split container. The question is what container I need to use for the right panel of the split container(panel 2) to place my controls on? There will be more than one such containers (as many as the menu options) and how these containers will show and hide based on the menu selection? I am currently using custom controls that are created and loaded dynamically based on the menu selection.

Any more ideas?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.