Results 1 to 5 of 5

Thread: Unable to display Message Box in ASP.NET using VB.NET

  1. #1
    Join Date
    Apr 2008
    Posts
    242

    Unable to display Message Box in ASP.NET using VB.NET

    The MessageBox class is a class that displays a MessageBox on the machine on
    which the application is running. An ASP.Net application runs on a server, When moving from Windows Forms to ASP.NET Web Forms, an API that may be missed is that offered by the System.Windows.Forms.MessageBox Class. How do i create one form in ASP.NET using VB in that how to show message box after clicking a button. In order to alert the user we need to inject some client side code into the HTML page. This is a simple task but can become quite a nuisance if this functionality is required on a regular basis.

  2. #2
    Join Date
    Jan 2006
    Posts
    211

    Re: Unable to display Message Box in ASP.NET using VB.NET

    The code which you will be created that you need to added to the HTML of the page sent to the client. You could add such a script using.

    Page.RegisterStartupScript(). Example:
    Dim strScript As String
    strScript = "<script type=""text/javascript"">alert('This is the testing application')</script>"
    If Not Page.IsStartupScriptRegistered("MyScript") Then
    Page.RegisterStartupScript("MyScript", strScript)
    End If

    This is the reason why we store the Queue in a Hashtable, because we are using static methods. There is the potential for multiple pages to be using the class at the same time (on separate threads).

  3. #3
    Join Date
    Oct 2008
    Posts
    65

    Re: Unable to display Message Box in ASP.NET using VB.NET

    MsgBox is located in System.Windows namespace, but ASP.Net is located in System.Web namespace.There is the potential for multiple pages to be using the class at the same time (on separate threads). So the environment will be different. But, If you could run it, please show to me how to configure your IIS.Forms namespace is usable only from Windows Forms and NOT ASP.NET Web Forms. In order to alert the user we need to inject some client side code into the HTML page.

  4. #4
    Join Date
    Jan 2009
    Posts
    143

    Re: Unable to display Message Box in ASP.NET using VB.NET

    Using JavaScript, you can access the dialog boxes while on page loading or after rendering the page content to the browser. There is no way to get a confirmation from the user while you process the functionality through JavaScript. To accomplish this you have to go for a server side message box.

    The following code will allow you to create web form code behind, add the following line of code:

    In VB.NET

    Code:
    Imports NewMsgBoxAsp.Holool.Anwar.Web.Controls.UI
    The following line Creates an instance of MessageBox class, to access its properties and methods:
    VB.NET

    Code:
    Dim NBox As MessageBox = New MessageBox

  5. #5
    Join Date
    Nov 2014
    Posts
    1

    Re: Unable to display Message Box in ASP.NET using VB.NET

    'ASP.net MessageBox
    'Add a scriptmanager to the ASP.Net Page

    <asp:scriptmanager id="ScriptManager1" runat="server" />

    try:

    Dim sMsg As String = "My Message"

    ScriptManager.RegisterStartupScript(Page, Page.GetType, Guid.NewGuid().ToString(), "alert('" & sMsg & "')", True)

Similar Threads

  1. Replies: 4
    Last Post: 20-08-2011, 07:13 PM
  2. Nokia E7 is unable to display any new message
    By Tees Mar KH in forum Portable Devices
    Replies: 4
    Last Post: 11-04-2011, 06:26 AM
  3. Replies: 4
    Last Post: 09-02-2011, 07:52 PM
  4. Need code to display message box in C++
    By amadeo in forum Software Development
    Replies: 3
    Last Post: 10-07-2009, 06:23 PM
  5. Display own Custom Message on Startup
    By Orlando in forum Customize Desktop
    Replies: 1
    Last Post: 02-03-2009, 06:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,651,341.08709 seconds with 17 queries