this is for inserting in database but it is not showing the image in gridview
this is for get image private void btnImage_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = "c:"; openFileDialog1.Filter = "All files (.)|."; openFileDialog1.FilterIndex = 2; openFileDialog1.RestoreDirectory = true;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
PictureBox PictureBox1 = new PictureBox();
PicBox.Image = new Bitmap(openFileDialog1.FileName);
// Add the new control to its parent's controls collection
this.Controls.Add(PicBox);
}
catch (Exception ex)
{
MessageBox.Show("Error loading image" + ex.Message);
}
}
}
