• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

How to display messagebox in asp.net VB class

how to display message in vb.net class .I have to display message in vb.net class file.name of the file is new.vb.I want to display message in vb class file
1 Solution
Try this:
System.Web.HttpContext.Current.Response.Write("<script>alert('" + ex.Message & "')</script>")

Open in new window

hi itgirl7,
first, in vb.net add reference to System.Windows.Forms.dll:
- select from the menu: "Project" then "Add Reference"
- from ".NET" tab select "System.Windows.Forms"
- press "Ok"button.

now import namespace Imports System.Windows.Forms
- add "Imports System.Windows.Forms" to the top of the class module
- then you can use Messagebox.Show() to display the messagebox
Deepak LakkadCommented:
If you want to use messagebox in ASP.Net Application, you have to use JavaScript's Alert() function.

MessageBox will be applicable to WinForms application not for ASP.Net applications

- Deepak
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now