Implementing Interfaces

The most common operation with interfaces that you will want to perform is implementation. You indicate that you want to implement an interface similar to the way you did so in VB6. The way to implement the members of an interface has changed. Let's take a look at implementing the IDrawable interface (see Listing 2.6). A synopsis follows the listing.

Listing 2.6. Implementing the IDrawable Interface
 1: Imports System.Drawing 2: 3: Public Class Form1 4: Inherits System.Windows.Forms.Form 5: 6: [ Windows Form Designer generated code ] 7: 8: Private Sub Draw(ByVal DrawableObject As IDrawable) 9: DrawableObject.Draw(CreateGraphics) 10: End Sub 11: 12: Private Sub Button1_Click(ByVal sender As System.Object, _ 13: ByVal e ...

Get Visual Basic® .NET Power Coding now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.