M
Michael Warlich
Hi NG
I'm a noob in ASP.NET and need help!
i have a function in C# which i want to translate in VB.NET
This is C#:
void ShowControlsRecrusiv(Control ctl, string indent)
{
HtmlControl htmldtl = (ctl as HtmlControl);
if(htmlctl != null)
{
Resonse.Write(string.Format("{0} {1}<br>, indent, htmlctl.TagName));
foreach(Control child in ctl.Controls)
ShowControlsRecrusiv(child, indent">");
}
}
And this is VB which i made
Sub ShowControlRecrusiv(ByVal ctrl As Control, ByVal ident As String)
Dim htmlctrl As HtmlControl = ctrl
If Not htmlctrl Is Nothing Then
Response.Write(String.Format("{0} {1}<br>", ident,
htmlctrl.TagName))
End If
Dim cchild As Control
For Each cchild In ctrl.Controls
ShowControlRecrusiv(cchild, ident & ">")
Next
End Sub
but at "Dim htmlctrl As HtmlControl = ctrl" occures the errormessage "The
indicated transformation is invalid."
What can i do?
Thx for Help!
P.S.: I'm german so i hope you understand my english
I'm a noob in ASP.NET and need help!
i have a function in C# which i want to translate in VB.NET
This is C#:
void ShowControlsRecrusiv(Control ctl, string indent)
{
HtmlControl htmldtl = (ctl as HtmlControl);
if(htmlctl != null)
{
Resonse.Write(string.Format("{0} {1}<br>, indent, htmlctl.TagName));
foreach(Control child in ctl.Controls)
ShowControlsRecrusiv(child, indent">");
}
}
And this is VB which i made
Sub ShowControlRecrusiv(ByVal ctrl As Control, ByVal ident As String)
Dim htmlctrl As HtmlControl = ctrl
If Not htmlctrl Is Nothing Then
Response.Write(String.Format("{0} {1}<br>", ident,
htmlctrl.TagName))
End If
Dim cchild As Control
For Each cchild In ctrl.Controls
ShowControlRecrusiv(cchild, ident & ">")
Next
End Sub
but at "Dim htmlctrl As HtmlControl = ctrl" occures the errormessage "The
indicated transformation is invalid."
What can i do?
Thx for Help!
P.S.: I'm german so i hope you understand my english