本文介绍了C# DataGridView 检查是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 datagridview,它填充了从 linq 查询返回的数据.如果查询没有返回结果,我想显示一个消息框.有没有办法检查datagridview是否为空?
I have a datagridview which gets filled with data returned from a linq query. If the query returns no results I want to display a messagebox. Is there a way of checking to see if the datagridview is empty?
问候
推荐答案
可以通过查看DataGridView中的行数来判断是否为空.如果 myDataGridView.Rows.Count == 0
那么你的 DataGridView 是空的.
You can find out if it is empty by checking the number of rows in the DataGridView. If myDataGridView.Rows.Count == 0
then your DataGridView is empty.
这篇关于C# DataGridView 检查是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论