In C# I can create an interface, and when I use the interface the compiler knows that certain interface requirements are fulfilled by the base class. This is probably clearer with an example:
interface FormInterface
{
void Hide();
void Show();
void SetupForm();
}
public partial class Form1 : Form , FormInterface
{
public Form1()
{
InitializeComponent();
}
public void SetupForm()
{
}
}
The compiler knows that Hide() and Show() are implimented in Form and the above code compiles just fine. I can't figure out how to do this in VB.Net. When I try:
Public Interface FormInterface
Sub Hide()
Sub Show()
Sub SetupForm()
End Interface
Public Class Form1
Inherits System.Windows.Forms.Form
Implements FormInterface
Public Sub SetupForm() Implements FormInterface.SetupForm
End Sub
End Class
But the Compiler complains that Form1 must implement 'Sub Hide()' for interface 'FormInterface'. Do I actually have to add
Public Sub Hide1() Implements FormInterface.Hide
Hide()
End Sub
On all my forms, or is a better route creating an abstract base class that has SetupForm() (and how do you do that in VB.net)?