C# to VB Overrides

J

Jim Heavey

Hello, I am trying to learn a little bit about tracing. I am using this
example in a book which is written in C# and attempting to convert it to VB.
Here is the C# code.

public class AspNetTraceListener : TraceListener
{
public override void Write(string msg)
{
System.Web.HttpContent.Current.Trace.Write(msg);
}
public override void WriteLine(string msg)
{
System.Web.HttpContent.Current.Trace.Write(msg);
}
}

My VB code looks like the following:

Public Class AspNetTraceListener
Inherits TraceListener

Public Overrides Sub Write(ByVal msg As String)
System.Web.HttpContext.Current.Trace.Write(msg)
End Sub

Public Overrides Sub WriteLine(ByVal msg As String)
System.Web.HttpContext.Current.Trace.Write(msg)
End Sub

End Class

It highlights "Write" and "WriteLine" method names and tells me that the
method name shawdows an overloadable member in the base class - If you want to
overload the base method, this method must be declared as "overloads".

I don't believe that I want to overload the method, I believe I want to
override. When I make the change suggested, then my class name highlights as
well as each of my methods.

It looked so simple, but I guess I am out of my league here.

Any suggestions as to what is wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top