I would like to open a file using open file dialog. If the opened file length is a multiple of 94 i would like to open that file if not i would like to throw an error message
Asked
Active
Viewed 101 times
1
-
makes me curious why you'd want to do that. are you serializing objects? and this is some kind of a check to make sure the file isn't corrupt? – neal aise Aug 26 '10 at 08:10
3 Answers
1
Something like:
if (new FileInfo(filename).Length % 94 != 0)
{
...
}
You may want to set OpenFileDialog.CheckFileExists
to true, too - or do a manual check before taking the length.

Jon Skeet
- 1,421,763
- 867
- 9,128
- 9,194