Help with Translation from C# to VB.NET

  • Thread starter Thread starter AMerrell
  • Start date Start date
A

AMerrell

Hello,

In C# I have seen subs overload each other that have the same signature. For example:

void IPostBackDataHandler.RaisePostDataChangedEvent()
{
((BasePostBackControl)this).RaisePostDataChangedEvent();
}

protected virtual void RaisePostDataChangedEvent()
{
}

To trasnlate this to VB.NET I came up with this:


Public Sub RaisePostDataChangedEvent() Implements IPostBackDataHandler.RaisePostDataChangedEvent
CType(Me, BasePostBackControl).RaisePostDataChangedEvent()
End Sub

Protected Overridable Sub RaisePostDataChangedEvent()
End Sub

Ofcourse I get the error that both have identical signatures. So, I rewrite them to this:

Public Overridable Sub RaisePostDataChangedEvent() Implements IPostBackDataHandler.RaisePostDataChangedEvent
End Sub

It clears up the Identical Signature problem but then the class that overrides this sub end up with different access level errors. And if I go with:

Protected Overridable Sub RaisePostDataChangedEvent()
End Sub

My IPostBackDataHandler implementation is in error. So my question is. How can I handle this in VB.NET?

Thanks for any help,

AM
 
My IPostBackDataHandler implementation is in error. So my question is. How can I handle this in VB.NET?

Implement IPostBackDataHandler.RaisePostDataChangedEvent under a
different name, that's what the C# code does.

Private Sub IPostBackDataHandler_RaisePostDataChangedEvent()
Implements IPostBackDataHandler.RaisePostDataChangedEvent
CType(Me, BasePostBackControl).RaisePostDataChangedEvent()
End Sub

Protected Overridable Sub RaisePostDataChangedEvent()
End Sub



Mattias
 
Back
Top