private void btnSelectImage_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "اختر صورة";
ofd.Filter = "Images|*.jpg;*.png";
if (ofd.ShowDialog() == DialogResult.OK)
{
if(File.Exists(ofd.FileName))
{
txtPathImage.Text = ofd.FileName;
Bitmap bmp = new Bitmap(Image.FromFile(txtPathImage.Text), new Size(100, 100));
picEmpImage.Image = bmp;
}
}
}
when i run the application ... the OpenFileDialog do not open and show me this error message
An unhandled exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
what i have to do !!??