2014-03-24 6 views
0

DataGridView "todos_pacientes"에 CellContentDoubleClick 이벤트가 있습니다. 버튼에서 CellContentDoubleClick 이벤트를 시뮬레이트하고 싶습니다. 어떻게하면 버튼 클릭 이벤트에서 호출 할 수 있습니까?버튼에서 CellContentDoubleClick 이벤트를 호출합니다. C#

private void toolSt_modificar_Click(object sender, EventArgs e) 
     { 

     }      


private void Datagrid_todos_pacientes_CellContentDoubleClick(object sender,DataGridViewCellEventArgs e) 

{ 
    id_paciente=Convert.ToInt32(Datagrid_todos_pacientes.Rows[e.RowIndex].Cells[0].Value.ToString()); 

    datos_paciente datos = new datos_paciente(); 
    datos.Show(); 

}  

답변

0

보십시오!

private void toolSt_modificar_Click(object sender, EventArgs e) 
{ 
    int col = Datagrid_todos_pacientes.CurrentCell.ColumnIndex; 
    int row = Datagrid_todos_pacientes.CurrentCell.RowIndex; 

    Datagrid_todos_pacientes_CellContentDoubleClick(sender, new DataGridViewCellEventArgs(col, row)); 
} 
+0

¡ 고마워, 그것은 완벽하게 :) – Josemanlp

+0

답을 "동의"제발 일

여기 내 코드입니다. – dovid

관련 문제