请问怎么在DataGrid中获取所选择的当前行 我要对DataGrid中显示的表进行更新updata,请问该怎么获取所选择的行,将所选择的行的纪录传到新窗口??有没有参考的代码?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 textbox1.text = DataGrid1.item[DataGrid1.CurrentRowIndex,0]....... 参看http://www.syncfusion.com/faq/windowsforms/Search/934.aspx private void fgData_MouseClick(object sender, MouseEventArgs e) { fgData.MouseRow }MouseRow就是选中的 DataRowView dv = (DataRowView)this.BindingContext[this.dataGrid1.DataSource].Current;textBox1.Text = drv["id"].ToString(); textBox2.Text = drv["name"].ToString(); wcmj(望尘莫及) ( ) 信誉:100 可以 数据库连结我用的是OLeDbconnection,怎么弄?? 我试了不行啊,错误信息:名称“drv”在类或命名空间“smartbilling.Form2”中不存在 private DataGridViewRow GetRow() { DataGridViewRow dr; dr = this.dgvItems.Rows[this.dgvItems.CurrentCell.RowIndex]; return dr; } 这就时当前行 DataRowView dv = (DataRowView)this.BindingContext[this.dataGrid1.DataSource].Current;textBox1.Text = drv["id"].ToString(); textBox2.Text = drv["name"].ToString();更正为: DataRowView drv =(DataRowView)this.BindingContext[this.dataGrid1.DataSource].Current;textBox1.Text = drv["id"].ToString(); textBox2.Text = drv["name"].ToString(); 想用.net做一个橡皮擦功能 是不是目标机上有.net 就可以运行自己的未打包程序啊? 如何加速图片的显示速度 小问题 跪求:如何在dataGrid中实现数据修改 winform 可以在Onload时强行关闭吗? 如何用SQLParameter,获得存储过程返回的值 一个关于C#递归的算法,求各路大神解答 实现增加、删除、修改在C#里DATAGRID是唯一,或是最好的控件了吗? 用CSC调试的问题, 遇到Windows的Performance Counter(性能计数器)问题! Invalidate和Refresh有什么区别?
.......
http://www.syncfusion.com/faq/windowsforms/Search/934.aspx
{
fgData.MouseRow
}MouseRow就是选中的
textBox1.Text = drv["id"].ToString();
textBox2.Text = drv["name"].ToString();
可以
private DataGridViewRow GetRow()
{
DataGridViewRow dr;
dr = this.dgvItems.Rows[this.dgvItems.CurrentCell.RowIndex];
return dr;
}
这就时当前行
textBox1.Text = drv["id"].ToString();
textBox2.Text = drv["name"].ToString();更正为:
DataRowView drv =(DataRowView)this.BindingContext[this.dataGrid1.DataSource].Current;
textBox1.Text = drv["id"].ToString();
textBox2.Text = drv["name"].ToString();