单击单元格任意地方事件
发布时间:2015-05-14 00:01:25
当我们在进行修改的时候,点击数据行,数据则会自动传送到相应的文本框中如图所示 //单击单元格任意地方事件 private void dgv_view_CellClick(object sender, DataGridViewCe ...
当我们在进行修改的时候,点击数据行,数据则会自动传送到相应的文本框中如图所示
- //单击单元格任意地方事件
- private void dgv_view_CellClick(object sender, Dataget='_blank'>GridViewCellEventArgs e)
- {
- int rowIndex = this.dgv_view.CurrentCell.RowIndex;
- if (rowIndex > -1)
- {
- if (this.dgv_view[0, rowIndex].Value.ToString() != string.Empty)
- {
- stu_id = Convert.ToInt32(this.dgv_view[0, rowIndex].Value.ToString());
- this.txt_name.Text = this.dgv_view[1, rowIndex].Value.ToString();
- this.txt_age.Text = this.dgv_view[2, rowIndex].Value.ToString();
- if (this.dgv_view[4, rowIndex].Value.ToString() == "男")
- this.rdo_man.Checked = true;
- else
- this.rdo_gdenman.Checked = true;
- this.cbo_class.Text = this.dgv_view[3, rowIndex].Value.ToString();
- this.txt_address.Text = this.dgv_view[5, rowIndex].Value.ToString();
- }
- else
- {
- MessageBox.Show("请选择数据行!");
- return;
- }
- }
- }
原标题:单击单元格任意地方事件
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。