OpenFileDialog.SafeFileName March 10, 2009
Posted by Bilal in .NET, C#, Microsoft, VB, Visual Studio 2005, Visual Studio 2008.Tags: 2.0, dotnet, OpenFileDialog, SafeFileName, SP1, VS2005, VS2008
2 comments
I had developed an application in VS2008 with .NET 2.0 . The application was deployed using the VS2008 deployment project with .NET Framework as pre-req. AutoCAD 2009 was already installed on all the client machines so the pre-req conditions were satisfied so .NET Framework was not skipped during the installation of the application.
Later on, I made a clean installation of WIN XP SP3 on my development machine. I skipped VS 2008 because I could not find its proper usage. VS2005 was sufficient for me.
Today, I got the a request for some updates in the application. For this purpose, I converted it to VS2005. On building the application is got the error about OpenFileDialog.SafeFileName. It was really a strange thing as the application was working smoothly on all the client machines.
SafeFileName returns only the File Name from the whole path. Although, I got the problem solved by doing some string operations:
String safeName = opdg.FileName.Substring(opdg.FileName.LastIndexOf("\\") + 1);
// 1 has been added to skip the \
I Googled about it and it was disclosed that this property is available in .NET Framework 2.0 SP1 which is installed along with VS2008.
PInvoke.net May 16, 2008
Posted by Bilal in .NET, C#, VB, Website Review, WIN32 API.Tags: .NET, C#, VB, WIN32 API
add a comment
Address: www.pinvoke.net
Its an excellent site which explain the use of WIN32 DLLs in .NET code ( C# or VB).
or
How to Provide a managed wrapper for an unmannaged code.
