默认的DataGridview选择第一个单元格. [英] Default DataGridview select first cell.

查看:134
本文介绍了默认的DataGridview选择第一个单元格.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



-默认DataGridview1选择了第一个单元格吗?.

如何调用

Hi,

- Default DataGridview1 selected first cell?.

How to call

DataGridview1_CellClick()

方法.

以及如何默认为第一个单元格值分配?.

这样的

method.

And How to default first cell value assign?.

Like that,

private void DataGridview1_CellClick(object sender, DataGridViewCellEventArgs e)
{
lblName.Text = DataGridview1 .Rows[e.RowIndex].Cells["Column0"].Value.ToString();
}



问候,
Karthikeyan,Bangalore



Regards,
Karthikeyan,Bangalore

推荐答案





要选择默认单元格(我想是左上角的单元格),您可以使用
Hi,



For selecting default cell ( I guess the cell in topleft corner) you can use
dataGridView1.Rows[0].Cells[0].Selected=true;





要设置默认单元格的值,请使用





For setting the value of default cell use

dataGridView1.Rows[0].Cells[0].Value = "akkywadhwa";


这篇关于默认的DataGridview选择第一个单元格.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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