Can anyone please help me. I was looking at the article "http://www.eggheadcafe .com/articles/20030603.asp". I am new to .net and know nothing in c#. I want to write a menu in asp.net. Can anyone please help me in converting this c# code to vb.net. I tried, but it is not giving the output. Here is the c# code
using System
using System.Collecti ons
using System.Componen tModel
using System.Data
using System.Drawing
using System.Web
using System.Web.Sess ionState
using System.Web.UI
using System.Web.UI.W ebControls
using System.Web.UI.H tmlControls
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPat h;
using System.IO;
using System.Text;
namespace MenuContro
public class PageMenu : System.Web.UI.U serControl
{
protected Label MenuPlaceHolder ;
private string xmlFile = String.Empty;
private string xslFile = String.Empty;
public string XmlFileName
{
get { return(xmlFile) ; }
set {xmlFile = value;}
}
public string XslFileName
{
get { return(xslFile) ; }
set {xslFile = value;}
}
private void Page_Load(objec t sender, System.EventArg s e)
{
string XmlSystemFileNa me = Server.MapPath( xmlFile);
string XslSystemFileNa me = Server.MapPath( xslFile);
XslTransform xslt = new XslTransform()
xslt.Load(XslSy stemFileName)
XPathDocument xpathdocument = ne
XPathDocument(X mlSystemFileNam e);
StringBuilder sb = new StringBuilder() ;
StringWriter sw = new StringWriter(sb );
xslt.Transform( xpathdocument, null, sw, null)
MenuPlaceHolder .Text = sb.ToString();
#region Web Form Designer generated cod
override protected void OnInit(EventArg s e
InitializeCompo nent()
base.OnInit(e)
private void InitializeCompo nent(
{
this.Load += new System.EventHan dler(this.Page_ Load)
#endregio
And here is the vb.net code that i converted. Anyone please tell me if this is correct or not
Imports Syste
Imports System.Collecti on
Imports System.Componen tMode
Imports System.Dat
Imports System.Drawin
Imports System.We
Imports System.Web.Sess ionStat
Imports System.Web.U
Imports System.Web.UI.W ebControl
Imports System.Web.UI.H tmlControl
Imports System.Xm
Imports System.Xml.Xs
Imports System.Xml.XPat
Imports System.I
Imports System.Tex
Namespace MenuContro
Public Class PageMen
Inherits System.Web.UI.U serContro
Protected MenuPlaceHolder As System.Web.UI.W ebControls.Labe
Private xmlFile As String = String.Empt
Private xslFile As String = String.Empt
Public Property XmlFileName() As Strin
Ge
Return (xmlFile
End Ge
Set(ByVal Value As String
xmlFile = valu
End Se
End Propert
Public Property XslFileName() As Strin
Ge
Return (xslFile
End Ge
Set(ByVal Value As String
xslFile = valu
End Se
End Propert
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles MyBase.Loa
Dim XmlSystemFileNa me As String = Server.MapPath( xmlFile
Dim XslSystemFileNa me As String = Server.MapPath( xslFile
Dim xslt As XslTransform = New XslTransform(
xslt.Load(XslSy stemFileName
'//Instantiate the XPathDocument Clas
Dim doc As XPathDocument = New XPathDocument(X mlSystemFileNam e
'//Instantiate the XslTransform Clas
Dim transform As XslTransform = New XslTransform(
'XPathDocument xpathdocument = Ne
'XPathDocument( XmlSystemFileNa me
Dim sb As StringBuilder = New StringBuilder(
Dim sw As StringWriter = New StringWriter(sb
'xslt.Transform (XPathDocument, Nothing, sw, Nothing)
transform.Load( XslSystemFileNa me)
'xslt.Transform (doc
MenuPlaceHolder .Text = sb.ToString()
End Sub
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
End Class
End Namespace
Your help will be greatly appreciated. Thanks for your help in advance.