I’m having trouble porting some .NET2-era C# to .NET2-era VB.NET. Specifically, I am trying to define an interface that an ASP.NET user control will implement.
(For background, I am trying to re-implement Phil Haack’s Model-View-Presenter example from several years ago.)
The C# interface I’m working from defines properties and events (IsPostBack, Load) that are already implemented by the base control.
However, VB.NET is forcing me to explicitly implement these properties/events in the user control (Public Property IsPostBack() As Boolean Implements IView.IsPostBack…). I’d like to just define these in the interface and not have to do anything special in the code-behind of the implementing user control.
I’m assuming that I can do this in VB.NET, I just don’t know how. I’ve spent all sorts of time googling/bing-ing, and haven’t come up with the answer.
Anyone have any ideas?
Unfortunately, this is not something you can do in VB.NET. VB.NET only does explicit interface implementation, so you would have to do something like this:
So you would have to implement all of those interface members again.