如何双击datagrid中一行,取数据显示在同一页中的各个text文本框中,最好有例子
如何双击datagrid中一行,取数据显示在同一页中的各个text文本框中,最好有例子
------解决方案--------------------先问个问题,为什么要双击?如果人在的话加我msn:seamanhy@hotmail.com告诉你
------解决方案--------------------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();   
 			}   
 		}   
 	} 
 }
------解决方案--------------------刚才写错了前面那部分可以不要的! 
 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(); 
 		}   
 	}   
 }
------解决方案--------------------dataGridView.DataSource  与一 dataBindingSource 绑定:   
 双击事件 : 
 DataRow dr =(this.dataBindingSource.Current as DataRowView).Row;   
 this.textBox1.Text=dr[ "字段名 "].ToString(); 
 ...