when i choose a row of dataGridView with the event Selectionchanged , how to display the record in textboxes ?
Thanks.

Recommended Answers

All 4 Replies

private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            int i = e.RowIndex;
            int j = e.ColumnIndex;

            Textbox.Text = dataGridView1.Rows[i].Cells[j].Value.ToString(); 
        }

Please use descriptive thread titles...'C#' does not describe the problem you are having.
Also, the policy here at Daniweb is to help those who show effort. Have a go for yourself then post if you have specific problems.
As a hint, the datagridview has a property called SelectedRows which returns an array of all the rows the user has selected.

thanks KDCORP87 for your helpful code

thanks Ryshad for your heplful advice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.