Skip to main content


Showing posts from June, 2008

SafeFileName Property and .Net 2.0 SP1

I built a small utility using C# Dot Net version 2.0 in which I took help of Open File Dialog box windows control to know user selected file path and name. I used “SafeFileName”(Gets a string that only contains the filename for the selected file.) property of OpenFileDialog box to display selected filename on the windows form. I did a fine testing on my development machine and deployed it on production computer. The production computer was up by freshly installed Windows Vista operating system (without SP1 update). since Vista ships with DotNet runtime, my job was as easy as copying my dot net executable assembly and double clicking it. When the OpenFileDialog box tried supplying user selected file name through “SafeFileName” property, it crashed! Damn...!!

The error message was clearly telling me that “method not found: OpenFileDailog.get_SafeFileName()”!! I was darn surprised. Though I did a quick fix for this problem by making use of FileName property (Gets or sets a string containi…