如何检查datagridview的行是否大于C#win表单中的特定数字 [英] How can I check if the rows the rows of a datagridview is greater than a particular number in C# win form

查看:60
本文介绍了如何检查datagridview的行是否大于C#win表单中的特定数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个datagridview,我存储名称,日期和时间,我有一个按钮,如果datagridview中的行大于1
$我不希望它可见b $ b但是按钮不能正常工作



我尝试过:



Good day everyone please i have a datagridview where i store name,date and time, and i have a button that i don't want it to be visible if the row in the datagridview is greater than 1
but the button does not work properly

What I have tried:

if (exam.dataGridView1.Rows.OfType<DataGridViewRow>().Take(1).Count() > 1)
            {
                inexaminfo.Enabled = false;
            }



还有这个


and also this

if (exam.dataGridView1.Rows.Count >1)
            {
                inexaminfo.Enabled = false;
              
            }

推荐答案

使用可见 [ ^ ]属性显示/隐藏控件



use Visible[^] property to show/hide the control

if (dataGridView1.Rows.Count > 1)
     inexaminfo.Visible = false;


这篇关于如何检查datagridview的行是否大于C#win表单中的特定数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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