如何检查是否在列的单元格值!= NULL? [英] How to check if value from a cell in a column is !=NULL?

查看:142
本文介绍了如何检查是否在列的单元格值!= NULL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在GridView控件更新,以检查是否从某列的单元格是!= NULL(检查,如果用户写的东西进入细胞)

I'm trying on gridview updated to check if a cell from a certain column is != NULL ( to check if the user wrote something into the cell)

我的问题是我不知道如何从细胞获得的X列的价值。

My problem is I don't know how to get the "x column" value from cell.

推荐答案

inzi伊琳娜请看看这个code。不要忘了投我,如果这可以帮助你。

inzi irina Please look at this code. don't forget to vote me if this helps you

private void button2_Click(object sender, EventArgs e)
    {
        foreach (DataGridViewRow dr in dataGridView1.Rows)
        {
            string lngth = Convert.ToString(dr.Cells[1].Value);
            if (lngth.Length > 0)
            {
                listBox1.Items.Add(dr.Cells[0].Value);
            }
        }
    }

这篇关于如何检查是否在列的单元格值!= NULL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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