C#中Windowsform的Rowdatabind事件 [英] Rowdatabind event for Windowsform in C#

查看:118
本文介绍了C#中Windowsform的Rowdatabind事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< pre> 我有一个datagridview,我希望当一个数据行绑定到GridView中的数据时,检查每一行的列的值是空的与否。 Windows窗体没有这样的RowDataBind事件。因此,我应该使用什么功能?!

<pre>I have a datagridview,I Want when a data row is bound to data in a GridView, check the value of a column of each row that is empty or not. Windows Forms does not have such a RowDataBind Event. Therefore, what function should I use?!

推荐答案

private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
    if (dataGridView1.Columns[e.ColumnIndex].Name == "")
    {
        if (dataGridView1[e.ColumnIndex, e.RowIndex].Value == null)
        { 
            // Action
        }
    }
}


参考我之前的回答 Windows DataGridView中GridView的RowDataBound等效事件 [ ^ ]。
Refer my previous answer GridView's RowDataBound equivalent event in Windows DataGridView[^].


这篇关于C#中Windowsform的Rowdatabind事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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