Message Box in ASP.NET Using VB 2.0 Framework

Posted: Thursday,March 12, 2009 in ASP.NET VB
Tags: , ,

Sometimes we want to use message box in asp.net. I’m using function which streaming out a javascript alert instruction. Here is the code below :

    Public Sub MsgBox(ByVal Message As String)
        System.Web.HttpContext.Current.Response.Write(“<SCRIPT LANGUAGE=””JavaScript””>” & vbCrLf)
        System.Web.HttpContext.Current.Response.Write(“alert(“”” & Message & “””)” & vbCrLf)
        System.Web.HttpContext.Current.Response.Write(“</SCRIPT>”)
    End Sub

Then we can try it in the other function such as :

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Page.Title = “Welcome Page”
 MsgBox(“Welcome To This Page”)
    End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s