Best-Practice - UserControls instead of Forms

From Visual WebGui Wiki

Jump to: navigation, search

Contents

Overview

This article describes a best-practice for Visual WebGui by which you would use UserControls instead of Forms for alternating the displayed UI.

Details

A Visual WebGui best practice is to only use Forms in these situations:

  1. When you want to show dialog windows.
  2. When you need different access points to your application – Different Forms with which the application can start.


In all other situations the best practice would be to use UserControls instead of Forms.
Your Form could contain a UserControl with Dock.Fill on the Form for example and when you want to switch screens, you could simply set the Visible property of the UserControl to ‘false’ and the Visible property of a different UserControl to ‘true’ and the other one will be shown instead.

This will in turn allow you to:

  • Switch views very easily without having to use a mechanism for navigating to a different Form.
  • Get a much faster and more efficient switch between application views.
  • Choose the view you would like to start with based on your server-side logic (IP address or user permissions of the user for example) while the users are all still using the same page URL.
  • Have a much more organized application solution, as you will be able to store all your different views (UserControls) with their own specific functionalities, in designated project folders.

References

Code Examples

Version 6.4 or newer is required to build the code sample sucessfully.

See Also

Personal tools