I want to show image in picture box from database clicked in datagridview.
Here is my code:
- private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if (e.RowIndex >= 0)
- {
- DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];
- txtEmpID.Text = row.Cells[0].Value.ToString();
- txtDeleteAndSearch.Text = row.Cells[0].Value.ToString();
- txtEmpName.Text = row.Cells[1].Value.ToString();
- dateTimePicker1.Text = row.Cells[2].Value.ToString();
- if (row.Cells[3].Value.ToString() == "Male")
- {
- radioMale.Checked = true;
- }
- else
- {
- radioFemale.Checked = true;
- }
- txtEmail.Text = row.Cells[4].Value.ToString();
- txtMSalary.Text = row.Cells[5].Value.ToString();
- txtAddr.Text = row.Cells[6].Value.ToString();
- txtMob.Text = row.Cells[8].Value.ToString();
- pictureBoxEmpPic.Image =row.Cells[9].Value as Image;
- txtPass.Text = row.Cells[10].Value.ToString();
- txtPassConf.Text = txtPass.Text;
- }
- }
every thing is OK, but image not showing in picturebox,
(pictureBoxEmpPic.Image =row.Cells[9].Value as Image; is not working)
Anybody help me?