Related Posts with Thumbnails

WinForms

Monday, May 3, 2010

WinForms is the most commonly used feature of .NET.
'Windows' based applications in .NET is called 'WinForms'. The .NET framework comes with a good number of classes to support 'Form' based application development.
A WinForm application will have atleast one 'Form' (window), which would be used for the interaction between the application and user. A Form can contain other controls like TextBox, Label, Button etc. Large WinForms applications will have several 'Forms', some of them used to capture data from user and some of them used to display data to user. By performing certain actions in each form, user can navigate to other 'Forms' in the application.

Event driven programming

Event Driven programming model is the most commonly used feature in modern programming. In this model, you will write appropriate code for each event. Examples for events are




  • Button Click



  • Mouse Move



  • Mouse Click



  • Key Press

    In Winforms application, users interact with the application using various actionsin the window (like clicking a button, moving mouse, pressing keys in keyboard etc). These actions will generate various events. When an event is generated, the code written for that event will be executed.

    For example, in a user registration screen, you may have several controls like text boxes where user can enter their name, address, age etc. Once user enter all the information, he may press the 'Submit' button. As a developer, you would have written code in the button click event, to save this user entered data into a database. This is how typically a WinForms based application works in an event driven programming model.

    To create WinForms applications:



  • Open Visual Studio .NET



  • Select the menu : File > New > Project



  • Choose from the project types : Visual C# Projects



  • From the Templates, choose the application type 'Windows Application'



  • Enter the project name in the space for 'Name'.



  • Make sure the 'Location' is pointing to your folder. You may press the Browse button to select your personal folder, so that all your projects will be saved in your folder.





  • Press 'OK' to create the projet. By default the project will be created with a sample form, named 'Form1'. You can drag and drop controls into this form, from the 'Toolbox' on the left hand side of the VS.NET. 





  • 0 comments:

    Post a Comment

    Site Rate