如何双击datagrid中一行,取数据显示在同一页中的各个text文本框中,最好有例子

解决方案 »

  1.   

    先问个问题,为什么要双击?如果人在的话加我msn:[email protected]告诉你
      

  2.   

    private void dataGrid_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    DataGrid.HitTestInfo hit = this.dataGrid.HitTest(e.X,e.Y) ; if(hit != null && hit.Type == DataGrid.HitTestType.Cell)
    {
    if(e.Button==System.Windows.Forms.MouseButtons.Left)
    {
    if(e.Clicks == 2)
    {

     DataRowView row = this.m_DataSet.Tables[0].DefaultView[this.dataGrid.CurrentRowIndex] ;
     this.txtbox.text=row[""].tostring();
    this.txtbox.text=row[""].tostring(); } } }
    }
      

  3.   

    刚才写错了前面那部分可以不要的!
    private void dataGrid_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
    if(e.Button==System.Windows.Forms.MouseButtons.Left)
    {
    if(e.Clicks == 2)
    {
     DataRowView row = this.m_DataSet.Tables[0].DefaultView[this.dataGrid.CurrentRowIndex] ;
     this.txtbox.text=row[""].tostring();
    this.txtbox.text=row[""].tostring();
    } }}
      

  4.   

    dataGridView.DataSource  与一 dataBindingSource 绑定:双击事件 :
    DataRow dr =(this.dataBindingSource.Current as DataRowView).Row;this.textBox1.Text=dr["字段名"].ToString();
    ...
      

  5.   

    System.Windows.Forms.MouseEventArgs eweb 程序,上面的怎么写?
      

  6.   

    上面FORM的例子很好,但我要的是web的,请高手帮忙给个方法~