Getting filesize from OpenFileDialog?

You can't directly get it from the OpenFieldDialog You need to take the file path and consturct a new FileInfo object from it like this: var fileInfo = new FileInfo(path) And from the FileInto you can get the size of the file like this fileInfo. Length For more info look at this msdn page.

You can't directly get it from the OpenFieldDialog. You need to take the file path and consturct a new FileInfo object from it like this: var fileInfo = new FileInfo(path); And from the FileInto you can get the size of the file like this fileInfo. Length For more info look at this msdn page.

I think there is 3 way, creating your custom open dialog or setting by code the view as detail or asking the user to use detail view.

If you mean when the dialog is running, I suspect you just change the file view to details. However if you mean programmatically I suspect that you'd have to hook a windows message when the file is selected.

Without interop and like the first comment, once the dialogue has been complete i.e. File/s have been selected this would give the size. Public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.

OK) { if (openFileDialog1. Multiselect) { long total = 0; foreach (string s in openFileDialog1. FileNames) total += new FileInfo(s).

Length; MessageBox. Show(total.ToString()); } else { MessageBox. Show(new FileInfo(openFileDialog1.

FileName).Length.ToString()); } } } File size during dialogue I feel would need to use interop Andrew.

Thanx for answers I want get filesize after the filedialog has been closed and show it I get file path from System.IO.Path. GetDirectoryName(op. FileName); but I can not find FILEINFo class.

System.IO. FileInfo – ThePower Aug 25 '09 at 9:52 oh thanx ThePower – Mary Aug 25 '09 at 10:35.

If (openFileDialog1.ShowDialog() == DialogResult. Foreach (string s in openFileDialog1. Total += new FileInfo(s).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions