获取所有row.cells数组,然后将其设置为txt的框 [英] Get to an array all row.cells and then set it's to txt's boxes

查看:72
本文介绍了获取所有row.cells数组,然后将其设置为txt的框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void DataGridView_SelectionChanged(object sender,EventArgs e)

{

foreach(DataGridView.SelectedRows中的DataGridViewRow行)

{

string surname = row.Cells [0] .Value.ToString();

string name = row.Cells [1] .Value.ToString();

string mobile1Tel = row.Cells [2] .Value.ToString();









txtSurname.Text =姓氏;

txtName.Text =姓名;

txtMobile1Tel.Text = mobile1Tel;









}

}



我尝试了什么:



获取数组all row.Cells然后将其设置为txt的框

private void DataGridView_SelectionChanged(object sender, EventArgs e)
{
foreach (DataGridViewRow row in DataGridView.SelectedRows)
{
string surname = row.Cells[0].Value.ToString();
string name = row.Cells[1].Value.ToString();
string mobile1Tel = row.Cells[2].Value.ToString();
.
.
.
.
txtSurname.Text = surname;
txtName.Text = name;
txtMobile1Tel.Text = mobile1Tel;
.
.
.
.
}
}

What I have tried:

Get to an array all row.Cells and then set it's to txt's boxes

推荐答案

从代码中看,最后一行将是您在你的文字框。当然,除非你在这种情况下有一系列文本框.....
From the code it appears that the last row will be the values you see in you text box. unless of course you have an array of text boxes in that case.....


这篇关于获取所有row.cells数组,然后将其设置为txt的框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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