What is the architecture of .NET win form applications?
C# Version
WinForm Architecture As stated earlier, .NET provides WinForm and other controls through base classes in the System.Windows.Forms namespace. The class System.Windows.Forms.Form is the base class of all WinForms in .NET. In order to design a windows application, we need: 1. Create a Windows Application project in Visual Studio.NET or add references to System.Windows.Forms and System.Drawing to your current project. If you are not using Visual Studio at all, use /reference option of the command line compiler to add these assemblies. 2. Write a new class to represent the WinForm and derive it from System.Windows.Forms.Form class as
class MyForm : System.Windows.Form
{
...
}
3. Instantiate various controls, set their appropriate properties and add these to MyForm’s Controls collection.
4. Write another class containing the Main() method. In the Main() method, call the System.Application.Run() method by supplying it an instance of MyForm.
class Test
{
static void Main()
{
Application.Run(new MyForm());
}
}
The Application.Run() method registers your form as a windows application in the operating system so that it may receive event messages from the Windows Operating System. VB.NET Version
WinForm Architecture As stated earlier, .NET provides the WinForm and other controls through base classes in the System.Windows.Forms namespace. The class System.Windows.Forms.Form is the base class of all WinForms in .NET. In order to design a windows application, we need to: 1.Create a Windows Application project in Visual Studio.NET, or add references to System.Windows.Forms and System.Drawing to your current project. If you are not using Visual Studio at all, use the /reference option of the command line compiler to add these assemblies. 2. Write a new class to represent the WinForm and derive it from the
System.Windows.Forms.Form class:
Public Class MyForm
Inherits System.Windows.Forms.Form
…
End Class
3. Instantiate various controls, set their appropriate properties and add these to MyForm's Controls collection. 4. Write another class containing the Main() method. In the Main() method, call the System.Application.Run() method, supplying it with an instance of
MyForm.
Class Test
Public Sub Main()
Application.Run(New MyForm())
End Sub
End Class
The Application.Run() method registers your form as a windows application in the operating system so that it may receive event messages from the Windows Operating System.
Index
Sponsored links
.Net Application Updating
One easy to use component adds safe and reliable updating features. Download today for a free trial.
One easy to use component adds safe and reliable updating features. Download today for a free trial.
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Online Crash Analysis
Automatically capture customer crash data, no debugger required. Support for .NET, C++, OS X, Java.
Automatically capture customer crash data, no debugger required. Support for .NET, C++, OS X, Java.
.Net Localization in three simple steps (WYSIWYG)
Localize .Net, C#/C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Localize .Net, C#/C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
