DataGridView的左侧有一个可以选定一整行数据的小三角形,通过它,我选定了某一行,如何将这行的各数据分配到各个textbox里面呢,我用的是这个方法,可是只能通过点击DataGridView里面的单元格才能显示(而且还不是每次都能显示,要很小心地点击),点击小三角形就不能显示了,
应该怎么改呢?
private void 信息DataGridView_Click(object sender, DataGridViewCellEventArgs e)
{
this.textBox2.Text = this.信息DataGridView.CurrentRow.Cells[0].Value.ToString();
this.textBox3.Text = this.信息DataGridView.CurrentRow.Cells[1].Value.ToString();
this.textBox4.Text = this.信息DataGridView.CurrentRow.Cells[2].Value.ToString(); }
应该怎么改呢?
private void 信息DataGridView_Click(object sender, DataGridViewCellEventArgs e)
{
this.textBox2.Text = this.信息DataGridView.CurrentRow.Cells[0].Value.ToString();
this.textBox3.Text = this.信息DataGridView.CurrentRow.Cells[1].Value.ToString();
this.textBox4.Text = this.信息DataGridView.CurrentRow.Cells[2].Value.ToString(); }
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货