Elevate your Windows Forms applications with a set of best practices designed to enhance user experience and maintainability. This guide covers key principles for design consistency, error logging, user settings management, and efficient data handling, ensuring your applications are both functional and user-friendly.
Almost everyone assumes today to use web forms for broad reach because of easy installation and cross platform compatibility. That is correct.
In the old days (1995-2000) companies used Windows Forms, later (2000-2007) they rolled their own ASP.NET solution, however since then (2007+) SharePoint has become the default choice for an intranet. When you need something richer and you can control the environment.
Code generators can be used to generate whole Windows and Web interfaces, as well as data access layers and frameworks for business layers, making them an excellent time saver. It's not crucial which one you use as long as you invest the time and find one you are happy with. The one important thing is they must have command line support and the files they generate should be recognizable as code generated by prefix or a comment like "Don't touch" as this was automatically generated code. Make it easy to run by putting all the command line operations in a file called '_Regenerate.bat'.
Use colours on incomplete is so useful in design time:
- <span style="background-color:red">Red</span> = Controls which are incomplete, e.g. An incomplete button
- <span style="background-color:yellow">Yellow</span> = Controls which are deliberately invisible that are used by developers e.g. Test buttons
All applications should be compatible with the Windows XP user interface and should be fully themed. Applications that do not use XP themes look like they were designed only for an earlier version of Windows. Mixing themed and non-themed controls looks equally unprofessional.
If you ask a new .NET developer (from the Access or VB6 world) what is the best thing about .NET Windows Forms, most of your answers will be "Form Inheritance" that allows them to keep a nice consistent look for all forms. If you ask them a couple of months later, they will probably tell you the worst thing about .NET Windows Forms is "Form Inheritance". This is because they have had too many problems with the bugs in the form designer regarding this feature. Many abandon them altogether and jump on the user control band wagon. Please don't... we have a solution to this...
One useful feature of inherited forms is the ability to lock the value of certain properties on the inherited copy. E.g.:
User controls allow you to have groups of elements which can be placed on forms.
Designing a user-friendly search system is crucial in today’s information-driven world, as it significantly enhances the user experience by enabling efficient and effective access to relevant data. A well-structured search interface not only simplifies the process of locating specific information amidst vast datasets but also caters to a variety of user needs, from basic inquiries to complex queries.
By prioritizing clarity, simplicity, and adaptability in search design, we can ensure that users can navigate and utilize applications more intuitively, leading to increased productivity, satisfaction, and overall success of the software.
Validation is extremely important on a data entry form. There are two ways to do validation:
In .NET, there are 2 ways to pass data through the layers of your application. You can:
- Do you know why you choose Windows Forms?
- Do you use code generators?
- Do you use red and yellow colours to distinguish elements in the designer?
- Do your applications support XP themes?
- Do you use inherited forms for consistent behaviour?
- Do you encapsulate (aka lock) values of forms?
- Do you know when to use User Controls?
- Do you know how to design a user friendly search system?
- Do you use Validator controls?
- Do you use DataSets or create your own business objects?
- Do your Windows Forms have a StatusBar that shows the time to load?
- Do you not cache lookup data in your Windows Forms application?
- Do you use the designer for all visual elements?
- Do you always use the Visual Studio designer for data binding where possible?
- Do you avoid using MDI forms?
- Do you have a correctly structured common code assembly?
- Are your Data Access Layers compatible with Web Services?
- Do you log all errors (with SSW Exception Manager)?
- Do you implement trace logging (with Log4Net)?
- Do you make a strongly-typed wrapper for app.config?
- Do you keep the standard .NET DataGrid?
- Do you replace the standard .NET Date Time Picker?
- Do you avoid 3rd party menus & toolbars?
- Do your List Views support multiple selection and copying?
- Do you use an image button for opening a web page taking action?
- Do your forms have Accept and Cancel buttons?
- Do you label buttons to be an action, like "Save, "Open", etc?
- Do you make "Enter" go to the next line when you have a multi-line textbox rather than hit the OK button?
- Do you make common controls with consistent widths?
- Do you support URLs on Windows Forms applications?
- Do you include "Back" and "Undo" buttons on every form?
- Do you save user settings and reuse them by default?
- Do you have a ResetDefault() function to handle messed up user settings?
- Do you use Threading to make your user interfaces more responsive?
- Do you display file name in the text box in full?
- Do you prevent users from running two instances of your application?
- Do you add a "(customized)" column in grid if there are default values?
- Do you have a standard menu item "Check for Updates"?
- Do you use Web Service to send emails?
- Do you always use GridView instead of ListBox?
- Do you know how to make .NET wrapper work on both x64 and x86 platforms?
- Do you set the ScrollBars property if the TextBox is Multiline?
- Do you know how to run write application to run with UAC turn on?
- Do you use AutoWaitCursor on Windows applications?
- Do you make your add/delete buttons crystal clear?
- Do you always set FirstDayOfWeek to Monday on a MonthCalendar?
- Do you always set ShowToday or ShowTodayCircle to true on a MonthCalendar?
- Do you set PasswordChar to "*" on a TextBox on sensitive data?
- Do you use Anchoring and Docking (full) for multiline textboxes?
- Anchoring and Docking - Do you use Anchoring and Docking (horizontal only) with single line textboxes?
- Do you know TextAlign should be TopLeft or MiddleLeft?