Hi,
I have no sample to give you here, but I'll try to explain why to use an interface.
An interface is useful when you want to design patterns of functionalities (methods) shared by different classes.
The advantage of the interface is that you don't need to know what class you're dealing with. If you know that you face an object that implements the interface, you can call the interface's methods directly on it.
Interface IPrintable
Sub Print
Sub PrintPreview
End Interface
Class Invoice
Implements IPrintable
...
End Class
Class SalesChart
Implements IPrintable
...
End Class
Class mdiMain
...
Sub PrintDocument(ByVal obj As IPrintable)
'this code will work on both an Invoice or SalesChart
'object passed as argument (the sub ignores what type
'is that object, but prints it anyway)
obj.Print
End Sub
End Class
... So the main benefit is to pass objects as procedure arguments, not as their respective 'true' type, nor as the lowest-level 'Object' type, but through the mask of the interface they all implement, as this gives you access to the functionalities that impersonate the interface.
You might want to test for the object's intrinsic type (horrible select case statements), but first this is poor code, and second, it is not scaleable. You might include a 'BuildingMap' class in a future release, that also might need to be printed. If so, coding it IPrintable will allow you to let your mdiMain code unchanged, while you'll be able to print a new type of document that did not exist in the first release.
An interface summarizes a set of functionalities that several classes may have in common. That capability should be described by an adjective ending with '-able'.
Little tip : try to design a class and make it ICloneable.
Cloneability is often useful, and it is easier to understand the benefits of implementing an existing .net framework interface rather to imagine a useful interface from scratch : theory is not very helpful as interfaces are created in response to very practical needs. There is quite no need for defining interfaces unless you design complete object models. A windows forms app that just displays data records does not need interfaces, they serve mainly in objects interactions.
Hope this helps (???)
Happy New Year anyway
Grunt