30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

578 Graphical User Interfaces Concepts: Part 2 Chapter 13<br />

Fig. 13.39 Class FrmInheritance, which inherits from class Form, contains a<br />

but<strong>to</strong>n (Learn More) (part 2 of 2).<br />

Fig. 13.40 <strong>Visual</strong> Inheritance through the Form Designer.<br />

Class Frm<strong>Visual</strong>Test (Fig. 13.41) is a derived class of class <strong>Visual</strong>-<br />

Form.FrmInheritance. The output illustrates the functionality of the program. The<br />

GUI contains those components derived from class FrmInheritance, as well as an<br />

additional but<strong>to</strong>n with text Learn The <strong>Program</strong>. When a user presses this but<strong>to</strong>n, method<br />

cmd<strong>Program</strong>_Click (lines 13–20) is invoked. This method displays another message<br />

box providing different informative text.<br />

Figure 13.41 demonstrates that the components, their layouts and the functionality of<br />

base-class FrmInheritance (Fig. 13.39) are inherited by Frm<strong>Visual</strong>Test. If a user<br />

clicks but<strong>to</strong>n Learn More, the base-class event handler cmdLearn_Click displays a<br />

MessageBox. FrmInheritance uses a Friend access modifier <strong>to</strong> declare its controls,<br />

so class Frm<strong>Visual</strong>Test cannot modify the controls inherited from class FrmIn-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!