Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing a Web Form After Page Load on ASP.Net
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00758554
Message ID:
00758609
Views:
17
Hi Florencio,

You need to include the following at the top of your Code-behind file to provide to the compiler information to know where to find the StringBuilder class:
Imports System.Text
Here is the sample code I provided in VB .NET syntax:
Dim sb As New StringBuilder()
sb.Append("<SCRIPT LANGUAGE = ""JavaScript"">")
sb.Append("self.close();")
sb.Append("</SCRIPT>")

If Not Page.IsStartupScriptRegistered("closewindow") Then
   Page.RegisterStartupScript("closewindow", sb.ToString())
End If
>Hi Cathi,
>
>I have a slight problem with your code. First of all I use VB.Net
>in my ASPX Pages and datatype 'StringBuilder' doesn't exist in my Object
>Browser or 'not Recocnized' by my machine.
>
>I think this is only applicable in C#. Do you have an idea that
>can work in VB.Net?
>
>Thanks Regards,
>
>Florencio
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform