填充文本框使用事件处理程序 [英] Populating Text box Using event handler
本文介绍了填充文本框使用事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是新编程请帮助。
我想用事件处理程序填充文本框..
nametxt .Text是我的文本框名称想要从sql列名填充数据..
Hi Guys, I m new to programming Please Help.
I want to populate text box using event handler..
nametxt.Text is my text box name want to populate data from sql column name..
private void dgvRowsEdit_DoubleClick(object sender, EventArgs e)
{
DataGridViewSelectedRowCollection rc = null;
rc = dataGridView1.SelectedRows;
nametxt.Text = rc[0].Cells["Name"].Value.ToString();
nictxt.Text = rc[0].Cells["[N.I.C]"].Value.ToString();
entrytxt.Text = rc[0].Cells["EntryTime"].Value.ToString();
emptxt.Text = rc[0].Cells["EmployeeName"].Value.ToString();
purposetxt.Text = rc[0].Cells["PurposeOFVisit"].Value.ToString();
remarkstxt.Text = rc[0].Cells["Remarks"].Value.ToString();
}
推荐答案
我认为你的代码会像..
I think your code would be something like..
DataGridViewRow dr = dataGridView1.SelectedRows[0];
nametxt.Text = dr.Cells[0].Value.ToString();
见..
DataGridView中选择的行的列的值,以文本框 [ ^ ]
DataGridView中选择的行的数据到文本框在C#的.NET [ ^ ]
这篇关于填充文本框使用事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文