Hello,
I am building a project using VB.NET and the .NET framework with VS.NET
2003. I am having a problem with a derived class that I can not understand.
I have a base class in a class library written in C# and I need a derived
class in my VB.NET application. The problem is that my derived method is not
being called, only the base class method in the library. I have overriden
the constructor and that works. Here is a skeleton of my code:
In C# library is this function, the class is itself derived from the Stream
class:
public override int Read(byte[] buf, int ofs, int count)
{
int toread = (int)Math.Min(count, m_Length - Position);
return Stream.Read(buf, ofs, toread);
}
In my VB.NET code:
Public Overrides Function Read(ByVal Buffer() As Byte, ByVal iOffset As
Integer, ByVal iCount As Integer) As Integer
Dim iBytesRead As Integer = MyBase.read(Buffer, iOffset, iCount)
If iBytesRead < iCount Then
'
' End of file
'
mEndOfFile = True
End If
Return iBytesRead
End Function
The VB method is not called. As I mentioned the overidden "New" is called.
Sid.