如何得到massagebox的值

csdn226 2002-03-28 04:11:35
massagebox执行时会出现一个对话框,是和否,我想让点击是和否的执行结果不同,
不知该如何做?
...全文
79 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
macro_love 2002-03-28
  • 打赏
  • 举报
回复
不好意思,我上面写错了。handle不要用引号,或直接用application.messagebox('确认删除当前记录吗','删除提示','MB_OKCANCEL+MB_ICONQUESTION')=IDOK then
//删除记录
macro_love 2002-03-28
  • 打赏
  • 举报
回复
if messagebox('handle','确认删除当前记录吗','删除提示','MB_OKCANCEL+MB_ICONQUESTION')=IDOK then
//删除记录
nkzgj 2002-03-28
  • 打赏
  • 举报
回复
if MessageBox(...........)=IDOK then
begin
.....
end
else if MessageBox(...........)=IDCANCEL then
.....
CeleronII 2002-03-28
  • 打赏
  • 举报
回复
同意楼上的
gzmhero 2002-03-28
  • 打赏
  • 举报
回复
iResult:=Application.MessageBox(...);
case iResult of
IDOK:
IDCANCEL:
IDYES:
IDNO:
end;
gzmhero 2002-03-28
  • 打赏
  • 举报
回复
判断Application.MessageBox的返回值。
IDOK 1 The user chose the OK button.
IDCANCEL 2 The user chose the Cancel button.
IDABORT 3 The user chose the Abort button.
IDRETRY 4 The user chose the Retry button.
IDIGNORE 5 The user chose the Ignore button.
IDYES 6 The user chose the Yes button.
IDNO 7 The user chose the No button.
一、升级说明 1、修复了数据库中字段为空的时候查询报错的Bug; 2、修复DbCommand属性ExecuteType为DbExecuteType.Scalar时执行命令报错的Bug; 3、感谢网友“尘世流浪汉”和“春之子”反馈Bug,也欢迎大家试用并提出更多建议! 二、修复功能示例 1、空测试 public class T_Test { public int? Id { get; set; } public string Name { get; set; } } try { //创建一个数据连接 DbConnection conn = new DbConnection("Data Source=|DataDirectory|CSmsPlatThird.db;Pooling=true;FailIfMissing=false"); //设置使用的数据访问程序集 conn.AssemblyName = "System.Data.SQLite"; //设置数据工厂,这里是SQLite的数据工厂 conn.DbProviderFactory = "System.Data.SQLite.SQLiteFactory"; //创建一个数据命令 DbCommandSyn cmd = new DbCommandSyn(); //设置命令的连接 cmd.Connection = conn; //设置SQL语句,可以是存储过程 cmd.CommandText = "SELECT [Id],[Name] FROM [T_Test]"; //设置命令类型,一般SQL语句是Text,存储过程是StoredProcedure cmd.CommandType = DbCommandType.Text; //设置执行类型 cmd.ExecuteType = DbExecuteType.Reader; //执行命令,得到结果 DbCommandExecuteResult result = cmd.Execute(); if (!string.IsNullOrEmpty(result.ErrMsg))//首先判断ErrMsg是否有,有表示执行过程发生错误 { MessageBox.Show("发生错误:" + result.ErrMsg); } else { List valueList = result.ReaderResult.ToEntityList(); //将数据显示在DataGrid中 this.dataGrid1.ItemsSource = valueList; } } catch (Exception ex) { MessageBox.Show("发生错误:" + ex.ToString()); } 2、存储过程示例 try { //数据库创建T_SQL脚本在网站App_Data文件夹下面,文件名为OMSDB.sql DbConnection conn = new DbConnection("Server=localhost;DataBase=OMSDB;Uid=sa;Pwd=jiton;"); DbCommandSyn cmd = new DbCommandSyn(); cmd.Connection = conn; //设置存储过程名称 cmd.CommandText = "JP_GetSystemName"; //设置命令类型为存储过程 cmd.CommandType = DbCommandType.StoredProcedure; cmd.ExecuteType = DbExecuteType.Scalar; //执行命令,得到结果 DbCommandExecuteResult result = cmd.Execute(); if (!string.IsNullOrEmpty(result.ErrMsg))//首先判断是否存在错误 { MessageBox.Show("发生错误:" + result.ErrMsg); } else { MessageBox.Show("系统名称为:" + result.ScalarResult as string); } } catch (Exception ex) { MessageBox.Show("发生错误:" + ex.Message); } 三、技术交流 有任何问题可以加入唯一指定的专用QQ群153079750进行反馈交流,也欢迎加入笔者的另一个Silverlight技术群175213051进行交流。

830

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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