The Microsoft .NET initiative involves a change in the fundamental structure of development and deployment. The .NET development platform integrates support for multiple development languages such as Visual Basic .NET and C# (pronounced see-sharp ) with the Common Language Runtime (CLR) and a shared Framework class library (FCL). These allow programmers to perform programmatic development in whatever language they are most comfortable, with a final solution integrating all the various code segments through common classes and runtime library inclusions.
Code development for the .NET environment may be performed using a text editor and the command-line compilers within the .NET SDK, but a more robust solution exists in the form of Microsoft's Visual Studio .NET product. This product includes an Integrated Development Environment (IDE) and advanced editing tools that make it possible to rapidly evaluate code and other .NET structures, use integrated debugging and automation tools, and integrate with the Windows Installer deployment utility in order to simplify application distribution and update.
Objects and ClassesVisual Basic .NET is an object-oriented language in which every construct is considered an object that has associated properties and methods and may contain other objects in turn . The abstract concept of a group of objects with common qualities is termed a class .
A class is a blueprint for an object rather than an object itself. Classes will have many properties, some created by the developer and others derived from the class itself. The properties and methods of a class can be split into two categories:
A class encapsulates both data and behavior into a single concept. In addition to having its own members, a class may inherit some or all of its members from a parent class. Class InheritanceSpecific methods of assigning inheritance are discussed later in this chapter, but Figure 1.1 provides an example of the chain of inheritance from a Windows form through its parent and that, in turn, back to the most fundamental classthe Object class. Figure 1.1. An example of class inheritance in which the Form class inherits from its parent classes.
The properties, or members , of a class that may be inherited can be limited by including an access modifier in their declaration. Within the Visual Studio .NET environment are four access modifiers you should be aware of:
NamespaceThe Visual Studio .NET development environment includes hundreds of classes, and you will develop many more for each project. In order to provide organization and structure to what could rapidly become an unmanageable number of classes, the development environment makes use of the concept of a namespace . This is a hierarchical naming system in which classes may be grouped as required. The standard naming convention for creation of a namespace is as follows : CompanyName.ApplicationName An example of this would be the creation of a namespace for this book: ExamCram2.70306 . Here, 70306 is the child namespace of the parent ExamCram2 namespace. If you created a class, ExamItems , within the 70306 namespace, the class would be designated as ExamCram2.70306.ExamItems . A separate ExamItems class could exist within a different namespace, such as in ExamCram2.70316.ExamItems . These are unrelated classes sharing only the common class name and are separated by the namespace groupings of 70306 and 70316 within the parent ExamCram2 namespace. The root namespace including all others is the System namespace. This contains the Object class ( System.Object ), which is the parent for all other classes in the .NET Framework. System also includes other objects and namespaces that we will deal with, such as the System.Drawing namespace, which includes classes used to create graphical elements, and the System.Windows namespace, which includes the System.Windows.Forms child namespace that includes the classes used to create Windows form objects.
Now that you are familiar with the basics of the conceptual side of the .NET development environment, we will examine the creation of a form within the Windows Form Designer. |