private void WorkerGrid_SelectionChanged(object sender, EventArgs e)
{
this.WorkerGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
txtwid.Text = this.WorkerGrid.CurrentRow.Cells[0].Value.ToString();
this.txtwname.Text = this.WorkerGrid.CurrentRow.Cells[1].Value.ToString();
this.txtwcard.Text = this.WorkerGrid.CurrentRow.Cells[2].Value.ToString();
this.txtwphone.Text = this.WorkerGrid.CurrentRow.Cells[3].Value.ToString();
this.txtaddress.Text = this.WorkerGrid.CurrentRow.Cells[4].Value.ToString();
}
winform DataGridView 选择行 获取数据
最新推荐文章于 2024-07-29 14:56:30 发布
本文介绍了一个使用C#编写的事件处理方法,该方法在DataGridView的选择发生变化时触发,用于同步显示所选行的数据到相应的文本框中。具体实现了当选择某一行时,能够自动填充工人的ID、姓名、身份证号、电话及地址等详细信息。
4075

被折叠的 条评论
为什么被折叠?



