C Sharp And Ms Access Database Tutorial 13 How To Display Selected Row From Datagridview To Picturebox Cell Click
C# And Ms Access Database Tutorial #13 – How To Display Selected Row From Datagridview To Picturebox Cell Click
VIDEO TUTORIAL
This Tutorial Shows How To Display Selected Row From Datagridview To Picturebox On Cell Click In C# Windows Forms Application using visual studio 2010.
C# SOURCE CODE
//Display Selected Datagridview Row Content On Input fields (Textboxes, PictureBoxes etc..) private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { //If DataGridViewRow Is clicked if (e.RowIndex >= 0) { DataGridViewRow selectedDataGridViewRow = dataGridView1.Rows[e.RowIndex]; txtID.Text = selectedDataGridViewRow.Cells[0].Value.ToString(); txtFullName.Text = selectedDataGridViewRow.Cells[1].Value.ToString(); txtEmailAddess.Text = selectedDataGridViewRow.Cells[2].Value.ToString(); txtPhoneNumber.Text = selectedDataGridViewRow.Cells[3].Value.ToString(); txtLanguage.Text = selectedDataGridViewRow.Cells[4].Value.ToString(); txtCountry.Text = selectedDataGridViewRow.Cells[5].Value.ToString(); txtgender.Text = selectedDataGridViewRow.Cells[6].Value.ToString(); txtImagePath.Text = selectedDataGridViewRow.Cells[7].Value.ToString(); //Convert Byte Array To Image pictureBox1.Image = convertByteArrayToImage((byte[])selectedDataGridViewRow.Cells[8].Value); } }