如何将currentcell值添加到datagridview中的下一个单元格并在c#.net中标记文本 [英] how to add the currentcell value to next cell in datagridview and to label text in c#.net

查看:133
本文介绍了如何将currentcell值添加到datagridview中的下一个单元格并在c#.net中标记文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将datagridview中当前单元格的内容添加到下一个单元格和标签文本属性.

I need to add the content of the current cell in a datagridview to the next cell and to a label text property.

MessegeBox.Show(dgv1.Rows[dgv1.CurrentRow.Index].Cells["creditAmt"].Value.ToString());


在这里我说一个错误
对象引用未设置为对象的实例."

有人可以给我发送解决方案吗?


here i am getting an error saying that
"Object reference not set to an instance of an object."

can any one send me the solution please

推荐答案

请确保dgv1.CurrentRow不是null.
Make sure that dgv1.CurrentRow is not null.
if (dgv1.CurrentRow != null)
{
  // code here
}


这篇关于如何将currentcell值添加到datagridview中的下一个单元格并在c#.net中标记文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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