In C #, I can create an interface, and when I use the interface, the compiler knows that certain interface requirements are met by the base class. This is probably more clear 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 implemented in Form, and the code above compiles just fine. I cannot 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 the "FormInterface" interface. Should I add the following?
Public Sub Hide1() Implements FormInterface.Hide
Hide()
End Sub
In all my forms, or is it the best route to create an abstract base class that has SetupForm () (and how do you do it in VB.NET)?