I need help, I have uploaded images to bd, now I have the following problem: I put this code to select a row from the datagridview and populate the respective fields.
txtIDMovie.Text = dgvMovies.Rows[e.RowIndex].Cells[0].Value.ToString();
txtNameMovie.Text = dgvMovies.Rows[e.RowIndex].Cells[1].Value.ToString();
txtRealizador.Text = dgvMovies.Rows[e.RowIndex].Cells[2].Value.ToString();
txtCatMovies.Text = dgvMovies.Rows[e.RowIndex].Cells[3].Value.ToString();
txtAnoMovie.Text = dgvMovies.Rows[e.RowIndex].Cells[4].Value.ToString();
txtClassIdade.Text = dgvMovies.Rows[e.RowIndex].Cells[5].Value.ToString();
txtClassIMDB.Text = dgvMovies.Rows[e.RowIndex].Cells[6].Value.ToString();
cbFormato.Text = dgvMovies.Rows[e.RowIndex].Cells[7].Value.ToString();
For the image I used:
byte[] bytes = (byte[])dgvMovies.Rows[e.RowIndex].Cells[8].Value;
MemoryStream ms = new MemoryStream(bytes);
pbCapa.Image = Image.FromStream(ms);
Only if you want to edit a field that does not yet have an image when selecting the line gives error. Is there any way to resolve?