Home > Net >  FileStream excuse me is always a hard, just out of abnormal, how to change?
FileStream excuse me is always a hard, just out of abnormal, how to change?

Time:03-08

Very simple interface, a picture box and a button, an open file dialog box, click the button pop-up dialog box, select a picture to load the picture box, and then want to read the file header information, total at this exception, how to do?
 
Private void button1_Click (object sender, EventArgs e)
{
DialogResult Dr=openFileDialog1. ShowDialog (this);
If (Dr==DialogResult. OK)
{
Try
{
PictureBox1. Image=Image. FromFile (openFileDialog1 FileName);
FileStream fs=new FileStream (openFileDialog1. The FileName, FileMode. Open);//an unusual
BinaryReader br=new BinaryReader (fs);
}
Catch Exception (err)
{
MessageBox. Show (err. Message);
}
}
}

This is the interface


This is an error message box
  •  Tags:  
  • C#
  • Related