C#DataGridView检查是否为空 [英] C# DataGridView Check if empty
本文介绍了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屋!
查看全文