datagridview中,如何选中一行或者一个数据 试了好多,都不行,我就想在网格中选中,然后让数据在下面的textBox中显示出来....谢谢各位了... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 this.dataGridView1.CurrentCell = this.dataGridView1[colIndex, rowIndex];object value = this.dataGridView1.CurrentCell.Value;if (value != null){ string strValue = value.ToString();} private void dataGridView1_SelectionChanged(object sender, EventArgs e) { this.textBox1.Text = this.dataGridView1.CurrentCell.Value.ToString(); } 首先先选中 dataGridView1,然后找一个cellclick的事件.private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { string str0 = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();//0为dataGridView1的索引值 string str1 = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();//1为dataGridView1的索引值 this.txtbox1.Text = str0; this.txtbox2.Text = str1; } 关于在DataTable中删除相关DataRow,急求 求解决 怎么没人理我呢!求大家来看看,help。。。。。 简单问题寻求帮助!!! c#问题 托管 EE 不理解表达式的语法?? 急!求解 DropDownList刷新页面问题!!!!!!多谢!!!! C++中的结构指针在C#中该怎样定义? ASP。NET高手请进---关于ASP。NET的运行问题--我抛100分,望快速给答案, 安装工程中添加文件造成IDE无响应 请问中外程序员的开发协作问题!有外企工作经验的开发人员请进。
object value = this.dataGridView1.CurrentCell.Value;
if (value != null)
{
string strValue = value.ToString();
}
{
this.textBox1.Text = this.dataGridView1.CurrentCell.Value.ToString();
}
{ string str0 = this.dataGridView1.CurrentRow.Cells[0].Value.ToString();//0为dataGridView1的索引值
string str1 = this.dataGridView1.CurrentRow.Cells[1].Value.ToString();//1为dataGridView1的索引值
this.txtbox1.Text = str0;
this.txtbox2.Text = str1;
}