convert C# to vb

T

TJS

need some help converting this to vb.
-- won't compile on "HtmlTextWriter "

========== C# code ==========================


protected override void Render(HtmlTextWriter writer)
{ private const string vMessage = "message goes here"

//*** Render the page and retrieve into StringBuilder
StringBuilder sb = new StringBuilder();
HtmlTextWriter hWriter = new HtmlTextWriter(new
StringWriter(sb));
base.Render(hWriter);

// *** store to a string
string PageResult = sb.ToString();

int At = PageResult.ToLower().LastIndexOf("");
if (At > -1)
PageResult = PageResult.Insert(At,vMessage);

// PageResult = PageResult.Replace("",vMessage);
// *** Write it back to the server
writer.Write(PageResult);

return;
}


================my progress so far===============================

Protected Overrides Sub Render(writer As HtmlTextWriter)
Dim vMessage As String = "message goes here"
'*** Render the page and retrieve into StringBuilder
Dim sb As New StringBuilder()
Dim hWriter As New HtmlTextWriter(New StringWriter(sb))
MyBase.Render(hWriter)

' *** store to a string
Dim PageResult As String = sb.ToString()
Dim At As Integer = PageResult.ToLower().LastIndexOf("")

If At > - 1 Then
PageResult = PageResult.Insert(At, vMessage)
End If

' PageResult = PageResult.Replace("",vMessage);
' *** Write it back to the server
writer.Write(PageResult)

Return
End Sub 'Render
 
T

Tom Shelton

TJS said:
need some help converting this to vb.
-- won't compile on "HtmlTextWriter "

Do you have the proper references? The code looks ok, from the quick glance
I've given it... Try checking your references and see if there is a
reference to System.Web.dll
 
T

TJS

thanks, I think I have the references worked out now and it does compile


how can I invoke the override function ?
 

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

Top