I have been trying to use the InitialDirectory on remote server without success. What I am trying to do is that: (comboBox1 has name of servers)
OpenFileDialog ofLogFile = new OpenFileDialog();
ofLogFile.Title = "Log for server: " + comboBox1.text;
OpenFileDialog.InitialDirectory = "\\\\" + comboBox1.text + "\\c$";
ofLogFile.RestoreDirectory = true;
and then there is an if check..
But it doesnt work. All i get is the local machine directoies. The thing is, when i put into InitialDirectory-
OpenFileDialog.InitialDirectory = @"\\server_name\c$";
It works just fine. Another thing that i tried to put is:
OpenFileDialog.InitialDirectory = "\\\\" + ((System.Data.DataRowView)
(this.comboBox1.SelectedItem)).ToString + "\\c$";
It also doesnt work.
I am starting the program with the appropriate permissions so it shouldn't be an issue. any suggestions?
Shouldn't it be:
ofLogFile.InitialDirectory = "\\\\" + comboBox1.text + "\\c$";
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With