怎样将dataGridView里选中的一行内容显示在textBox里 怎样将dataGridView里选中的一行内容显示在textBox里用什么事件可以实现?在哪里可以找到这个事件?为什么我双击datagridview控件只能显示dataGridView1_CellContentClick事件? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DataGridViewCellClick事件可以处理 在哪里可以找到DataGridViewCellClick事件? 选中该控件,看属性,有个事件,都在里面了!可以在事件里这样做DataRow dr;dr = dat.Rows[dataGridView1.CurrentRow.Index];然后把dr里的对应内容给TextBox就可以了 Grid_Food_RowCommand事件,e.CommandArgument获取你要的值e.CommandName获取name下面是前台 <asp:LinkButton ID="lbtn_del" runat="server" text="XXXX" CommandArgument='<%# Eval("ID") %>' CommandName="del"></asp:LinkButton> 贴个以前我写的 看看对你是否有帮助在在RowEnter事件下写如下代码if (this.ClassRoomView.SelectedRows.Count > 0) { //教室ID this.RoomId = ClassRoomView.SelectedRows[0].Cells["RoomID"].Value.ToString(); //教室名称 this.TxbName.Text = ClassRoomView.SelectedRows[0].Cells["RoomName"].Value.ToString(); //教室描述 this.TxbDescribe.Text = ClassRoomView.SelectedRows[0].Cells["RoomDescribe"].Value.ToString(); //教室容量 this.TxbCapacity.Text = ClassRoomView.SelectedRows[0].Cells["RoomCapacity"].Value.ToString(); }最后把gridview的SelectionMode的属性改成FullRowSelect 怎么写的都不一样啊我用的是VS2008,C# winform 绑定一下,这个是我程序里的片段BindingSource MainBind = new BindingSource();MainBind.DataSource = DsBase;MainBind.DataMember = sTblMain; DataGridView.AutoGenerateColumns = false; DataGridView.DataSource = MainBind; textBox1.DataBindings.Add("Text", MainBind, ".BILL_CODE"); dateTimePicker1.DataBindings.Add("Text", MainBind, ".BILL_DATEA"); dateTimePicker2.DataBindings.Add("Text", MainBind, ".BILL_DATEB"); dateTimePicker3.DataBindings.Add("Text", MainBind, ".BILL_DATEC"); comboBox1.DataBindings.Add("Text", MainBind, ".BILL_COMPANYA"); comboBox1.DataSource = DsBase.Tables[sTblComA]; comboBox1.DisplayMember = "BILL_COMPANYA"; comboBox1.ValueMember = "BILL_COMPANYA"; 怎样将dataGridView里选中的一行内容显示在textBox里 用什么事件可以实现?在哪里可以找到这个事件?为什么我双击datagridview控件只能显示 dataGridView1_CellContentClick事件?////////////////////////////////////////////选中dataGridView1 然后在属性面板里单击类似闪电的那个符号(代表控件的事件)找到SelectionChanged事件进去后:填写如下代码: this.textBox39.Text = dataGridView1.CurrentCell.OwningRow.Cells[12].Value.ToString(); 怎样将dataGridView里选中的一行内容显示在textBox里 用什么事件可以实现?在哪里可以找到这个事件?为什么我双击datagridview控件只能显示 dataGridView1_CellContentClick事件? //////////////////////////////////////////// 选中dataGridView1 然后在属性面板里单击类似闪电的那个符号(代表控件的事件) 找到SelectionChanged事件 进去后: 填写如下代码: this.textBox39.Text = dataGridView1.CurrentCell.OwningRow.Cells[12].Value.ToString();其中:...Cells[12]..中的12由你自己决定,使显示的列的标识,类似数组的下标 winform中动态添加多个控件后,超出窗体初始大小,显示的格式不正确了 启动页修改不了 怎么MouseEnter()MouseLeave()不好用啊? 如何连接并控制远程计算机并获取远程计算机的临时文件夹路径? dataAdapter查询语句配置IN的问题 父类中引用子类中的特有类型 请问C#WINFORMS如何实现这样的菜单功能?? winForm 如何将11111111 加密成G72IZGCCcBXl1gXtRCUiUQ==字符串 如何获得某类在app中的实例数目,急 求助——用什么控件做这样的界面啊? shareliving同学请进 不得不再问...关于获取和控制外部窗口的API
DataRow dr;
dr = dat.Rows[dataGridView1.CurrentRow.Index];
然后把dr里的对应内容给TextBox就可以了
e.CommandArgument获取你要的值
e.CommandName获取name
下面是前台
<asp:LinkButton ID="lbtn_del" runat="server" text="XXXX" CommandArgument='<%# Eval("ID") %>' CommandName="del"></asp:LinkButton>
在在RowEnter事件下写如下代码
if (this.ClassRoomView.SelectedRows.Count > 0)
{
//教室ID
this.RoomId = ClassRoomView.SelectedRows[0].Cells["RoomID"].Value.ToString();
//教室名称
this.TxbName.Text = ClassRoomView.SelectedRows[0].Cells["RoomName"].Value.ToString();
//教室描述
this.TxbDescribe.Text = ClassRoomView.SelectedRows[0].Cells["RoomDescribe"].Value.ToString();
//教室容量
this.TxbCapacity.Text = ClassRoomView.SelectedRows[0].Cells["RoomCapacity"].Value.ToString();
}
最后把gridview的SelectionMode的属性改成FullRowSelect
我用的是VS2008,C# winform
BindingSource MainBind = new BindingSource();MainBind.DataSource = DsBase;
MainBind.DataMember = sTblMain; DataGridView.AutoGenerateColumns = false;
DataGridView.DataSource = MainBind; textBox1.DataBindings.Add("Text", MainBind, ".BILL_CODE");
dateTimePicker1.DataBindings.Add("Text", MainBind, ".BILL_DATEA");
dateTimePicker2.DataBindings.Add("Text", MainBind, ".BILL_DATEB");
dateTimePicker3.DataBindings.Add("Text", MainBind, ".BILL_DATEC"); comboBox1.DataBindings.Add("Text", MainBind, ".BILL_COMPANYA");
comboBox1.DataSource = DsBase.Tables[sTblComA];
comboBox1.DisplayMember = "BILL_COMPANYA";
comboBox1.ValueMember = "BILL_COMPANYA";
用什么事件可以实现?在哪里可以找到这个事件?为什么我双击datagridview控件只能显示
dataGridView1_CellContentClick事件?
////////////////////////////////////////////
选中dataGridView1 然后在属性面板里单击类似闪电的那个符号(代表控件的事件)
找到SelectionChanged事件
进去后:
填写如下代码:
this.textBox39.Text = dataGridView1.CurrentCell.OwningRow.Cells[12].Value.ToString();
用什么事件可以实现?在哪里可以找到这个事件?为什么我双击datagridview控件只能显示
dataGridView1_CellContentClick事件?
////////////////////////////////////////////
选中dataGridView1 然后在属性面板里单击类似闪电的那个符号(代表控件的事件)
找到SelectionChanged事件
进去后:
填写如下代码:
this.textBox39.Text = dataGridView1.CurrentCell.OwningRow.Cells[12].Value.ToString();
其中:...Cells[12]..中的12由你自己决定,使显示的列的标识,类似数组的下标