Solved

Visual c# form design - Best practices

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

708 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

20 Experts available now in Live!

Get 1:1 Help Now