Solved

Visual c# form design - Best practices

Posted on 2006-11-01
4
316 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 102
base64 decode encode 12 121
move one pixel 4 58
simplest php form 3 63
This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now