我要对DataGrid中显示的表进行更新updata,请问该怎么获取所选择的行,将所选择的行的纪录传到新窗口??
有没有参考的代码??

解决方案 »

  1.   

    textbox1.text = DataGrid1.item[DataGrid1.CurrentRowIndex,0]
    .......
      

  2.   

    参看
    http://www.syncfusion.com/faq/windowsforms/Search/934.aspx
      

  3.   

    private void fgData_MouseClick(object sender, MouseEventArgs e)
            {
                fgData.MouseRow
            }MouseRow就是选中的
      

  4.   

    DataRowView dv = (DataRowView)this.BindingContext[this.dataGrid1.DataSource].Current;
    textBox1.Text = drv["id"].ToString(); 
    textBox2.Text = drv["name"].ToString();
      

  5.   

    wcmj(望尘莫及) ( ) 信誉:100 
    可以
      

  6.   

    数据库连结我用的是OLeDbconnection,怎么弄??
      

  7.   

    我试了不行啊,错误信息:名称“drv”在类或命名空间“smartbilling.Form2”中不存在
      

  8.   


            private DataGridViewRow GetRow()
            {
                DataGridViewRow dr;
                dr = this.dgvItems.Rows[this.dgvItems.CurrentCell.RowIndex];
                return dr;
            }
            这就时当前行
      

  9.   

    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();