Windows applications are event-driven. The application user's actions create events, and these events drive the order in which things happen in the application. However, without code, the event generally comes and goes as if it never happened. The application takes an action when a user clicks a menu item or selects text only because a programmer wrote code that ran when that event occurred. That code is inside an event procedure, which is how Visual Basic .NET connects an event to the code you want to run when the event occurs.

The purpose of the code inside the event procedure often is to change the application's state, which is reflected in the properties of the application's objects. You can access or change the values of properties of various objects involved in the application both through code at runtime and through the Windows Forms Designer at design time.

The form is perhaps the most important control. However, a single form without controls could only satisfy the requirements of the simplest Windows application. The form does not permit typing of text, listing data, selection of choices, or many other tasks that an application may need to perform. You need other, specialized controls for that additional functionality. Indeed, the form's primary role is to serve as a host, or container, for controls such as menus, toolbars, and buttons, which enrich the GUI of Windows applications. This module showed you how to add controls to your form and to use them in your application.

Was this article helpful?

0 0

Post a comment