I want the function, when I perform CellDoubleClick Event of DataGridView, the concerned data to be pass into the concerned controls. Here how they would be:-
But none of the data is passing to the concerned controls.
Thus Getting an Error. Here the error;-
Please take a look to the Sql Server Stored Procedure to do this function:-
ALTER PROCEDURE CustomerView
@customerId int
AS
SELECT Name, Address, DOB, motherTongue, Nationality
FROM tbl_Customer where customerId=@customerId

Abhay ShankerPosted Jan 5, 2014, 10:16 PM
private void dgvCustomerDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > -1 && e.ColumnIndex > -1)
{
textBox1.Text = dgvCustomerDetails.Rows[e.RowIndex].Cells[0].Value.ToString();
textBox2.Text = dgvCustomerDetails.Rows[e.RowIndex].Cells[1].Value.ToString();//If date Try to convert in datetime accordingly.
textBox3.Text = dgvCustomerDetails.Rows[e.RowIndex].Cells[2].Value.ToString();
}
}
Hope this will be helpful to you