文本框应填写网格视图的行单击 [英] Textbox should fill on row click of a grid view
本文介绍了文本框应填写网格视图的行单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当点击gridview的一行时,文本框应该使用c#
When Clicking on a row of a gridview the text box should fill in windows application using c#
推荐答案
textbox-text-changed-event-on-datagridview-cell /
从GridView中激活textbox textchanged事件
您好
尝试此代码..在很多方面你可以实现它..这是方法之一。 。
Hi
Try this code.. In Many ways u can implement it.. this is one of the method..
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("ID", typeof(int));
dt.Rows.Add("aaaa", 1);
dt.Rows.Add("bbbb", 2);
dt.Rows.Add("cccc", 3);
dt.Rows.Add("ddd", 4);
dt.Rows.Add("eeee", 5);
dataGridView1.DataSource = dt;
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBox1.Text = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value + "";
}
这篇关于文本框应填写网格视图的行单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文