0

In my wpf application I need a button which lets me select a file from my local system and upload it.
When I click the button for the first time and upload there is no problem; from the second onwards, there is this pop-up message box which displays

You can’t open this location using this program.
Please try a different location. openfiledialog

I can close that message and select my file.
But why is this appearing anyway?

Dan Puzey
  • 33,626
  • 4
  • 73
  • 96
Laya
  • 59
  • 1
  • 1
  • 11
  • 1
    You should edit your question showing us some code... – Marco Aug 20 '12 at 12:04
  • You can look there: [OpenFileDialog default path][1] Check hes code, maybe it can help? [1]: http://stackoverflow.com/questions/9980262/openfiledialog-default-path – mlemay Aug 20 '12 at 12:04
  • Hi mlemay, thanks a lot for the example shown. I have realised the place of the problem. I am passing a string to the initiladirectory which has the lastopenenddfile's path. hence the directory is trying to open the file and hence showing the above message. I truncated the filepath to get the folder path and assigned it to the initialdirectory. Now working fine.. – Laya Aug 22 '12 at 08:16

1 Answers1

3

I am passing a string to the initialdirectory property which has the lastopenenddfile's path. hence the directory is trying to open the file and hence showing the above message. I truncated the filepath to get the folder path and assigned it to the initialdirectory. Now working fine..

Laya
  • 59
  • 1
  • 1
  • 11
  • If this is the solution to your question, please mark the answer as accepted, to improve your accept rating. – Coral Doe Aug 30 '12 at 07:17