如何在c#中显示消息框 [英] how to display a message box in c#

查看:296
本文介绍了如何在c#中显示消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个按钮来搜索数据库中的记录。我想显示一个消息框,说没有在数据库中找不到记录时找到记录。

这是我搜索数据库的代码:

this.administratorTableAdapter.FillBy (this.eMYSDataSet.Administrator,%+ textBox1.Text +%);

i have a button to search a database for records. I want to display a messagebox to say no records found when no records are found in the database.
this is my code for searching the database:
this.administratorTableAdapter.FillBy(this.eMYSDataSet.Administrator, "%" + textBox1.Text + "%");

推荐答案

怎么样...
if (this.eMYSDataSet.Administrator.Count == 0)
{
    MessageBox.Show("No records on Database");
}
else
{
    //rest of your code here
}


这篇关于如何在c#中显示消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆