当我的客户 BindingSource 从 datagridview 搜索客户时,
当找不到匹配项时,我需要一个显示“未找到结果”的消息框,而不仅仅是
什么也不显示。
尝试这个 :
Dim emptyRowCount As Integer = IIf(DataGridView1.AllowUserToAddRows, 1, 0)
Dim filterRowCount As Integer = DataGridView1.Rows.GetRowCount(DataGridViewElementStates.Visible)
If filterRowCount <= emptyRowCount Then MessageBox.Show("No Result Found")
我放第一行是因为如果它找不到匹配项并且你有DataGridView1.AllowUserToAddRows = True
,它得到 1 空的新行正在计数,如果有,它得到 0DataGridView1.AllowUserToAddRows = False
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)