Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 16 Inheriting Forms and Creating Base Classes 411



  1. Click Display Record.


Your program stores the first name and last name values in property settings and then
displays the following input box, which prompts the new teacher for the grade he or
she teaches:


  1. Type 3 , and then click OK to close the input box.


The application stores the number 3 in the new Grade property and uses the
FirstName, LastName, and Grade properties to display the new employee information
in a confirming message box. You see this message:


  1. Experiment with a few more values if you like, and then click the Close button on the form.


The program stops, and the development environment returns. You’re finished working
with classes and inheritance in this chapter. Nice job!

Further Experiments with OOP
If you’ve enjoyed this foray into object-oriented coding techniques, more fun awaits
you in Visual Basic 2010, a truly OOP language. In particular, you might want to add
events to your class definitions, create default property values, declare and use named
and anonymous types, and experiment with a polymorphic feature called method
overloading. These and other OOP features can be explored by using the Visual Studio
Help documentation or by perusing an advanced book on Visual Basic programming.
(See the Appendix, “Where to Go for More Information,” for a reading list .) You’ll also
find that a thorough knowledge of classes and how they are created will serve you
well as you move more deeply into the .NET Framework and advanced topics like
database programming. For the relationship between OOP and databases in Visual
Basic, see Part IV, “Database and Web Programming .”
Free download pdf