请问在c#中如何实现对话框功能?

sydeng 2003-08-21 10:10:32
请问在c#中如何实现对话框功能?就象在vb.pb中messagebox()功能一样。
我看见网上有MessageBox.Show(),我用了,但用不了,是不是要加上什么名字空间?
或者还有什么别的方法?
...全文
121 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
ms44 2003-08-22
  • 打赏
  • 举报
回复
response.writ("<javascript language=javascript defer>prompt("hello")</script>")
liq1979 2003-08-22
  • 打赏
  • 举报
回复
response.write("<script language=javascript defer>alert('消息')</script>")
dengsy 2003-08-22
  • 打赏
  • 举报
回复
response.write("<script>alert('消息')</script>")
liduke 2003-08-22
  • 打赏
  • 举报
回复
response.write("<script>alert('1111')</script>")
cnhgj 2003-08-21
  • 打赏
  • 举报
回复
RegisterStartupScript("","<script>alert('ddd');</script>");
xiaoqi333 2003-08-21
  • 打赏
  • 举报
回复
网页可用:Button1.Attributes.Add("onclick","return confirm('dddddddddd');");
kuangren 2003-08-21
  • 打赏
  • 举报
回复

using System.windows.Form


MessageBox.Show("hello");
hotnoodle 2003-08-21
  • 打赏
  • 举报
回复
response.write("<script>alert('消息')</script>")
烤火的鱼 2003-08-21
  • 打赏
  • 举报
回复
不说清楚。
zjw19 2003-08-21
  • 打赏
  • 举报
回复
呵呵
sydeng 2003-08-21
  • 打赏
  • 举报
回复
我想在做网页中使用,好象上面的不行啊。。。。
covis 2003-08-21
  • 打赏
  • 举报
回复
仅在WINFORM中
covis 2003-08-21
  • 打赏
  • 举报
回复
using System.Windows.Forms;

MessageBox.Show("没有选中的文件","提示",MessageBoxButtons.OK,MessageBoxIcon.Hand,MessageBoxDefaultButton.Button1);//有多个重载
FengLinXp 2003-08-21
  • 打赏
  • 举报
回复
直接在文件中写
System.Windows.Forms.MessageBox.Show("1111");

或者在文件顶部
using System.Windows.Forms;
在下面调用
MessageBox.Show("111");
xiaoqi333 2003-08-21
  • 打赏
  • 举报
回复
1. using System.Windows.Forms;
MessageBox.Show("");
2. 显示可包含文本、按钮和符号(通知并指示用户)的消息框
MessageBox.Show("You must enter a name.", "Name Entry Error",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
3. string message = "您真的要删除当前记录吗?是,将删除;否,将取消此操作。";
string caption = "删除确认";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
DialogResult result;
result = MessageBox.Show(this, message, caption, buttons,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button1
);

if(result == DialogResult.Yes)
{

//相关代码

}
heroux 2003-08-21
  • 打赏
  • 举报
回复
添加引用如:
using System.Windows.Forms;
然后在方法中调用:
MessageBox.Show();
liyue1997 2003-08-21
  • 打赏
  • 举报
回复
system.form
tflantian 2003-08-21
  • 打赏
  • 举报
回复
Page.RegisterStartupScript("","<script>window.open('OpenWindow')script>");
bassil 2003-08-21
  • 打赏
  • 举报
回复
up

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧