Solved

Visual c# form design - Best practices

Posted on 2006-11-01
4
321 Views
Last Modified: 2013-12-04
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
0
Comment
Question by:panayoti
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
DonKyles earned 75 total points
ID: 17863319
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
 
LVL 15

Assisted Solution

by:angus_young_acdc
angus_young_acdc earned 50 total points
ID: 17865330
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
 
LVL 6

Assisted Solution

by:DonKyles
DonKyles earned 75 total points
ID: 17872052
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
 

Author Comment

by:panayoti
ID: 17926731
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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 86
splitOdd10 challenge 5 106
Program to display an alert on Windows Toolbar 2 79
Not needed 13 112
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This is an explanation of a simple data model to help parse a JSON feed
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question