MessageBox in C# showing error

两盒软妹~` 提交于 2019-12-05 04:23:45

Use This:

System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + Message + "')", true);

Hope This help.

slugster

The key words in your description are

web application

This functionality is only available in client (WinForms, WPF) based applications, not ASP.NET. To do this in a web app you will need to use Javascript, as illustrated in this previous Stack Overflow question.

The MessageBox class in the System.Windows.Forms namespace is usable from Windows Forms and Not ASP.NET Web Forms.

System.Windows.MessageBox is used in WPF applications and System.Windows.Forms.MessageBox is used in Windows Form applications but your project is WebApplication so you don't have access to any of them.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!