Getting file's directory

I'm trying to get the full directory path for a file in VB .NET and have tried a variety of techniques.  My biggest problem is either a 'NULL' return or a "" return.

Attempts include:

1. FileSystemInfo.FullName .... this returns a Null

2. FileInfo.Directory....returns a Null

How do I get this work without it returning a null result




Answer this question

Getting file's directory

  • Jade Skaggs

    Thank's for that last post...unfortunately I'm working in VB .Net.

    Maybe if my questions were better worded I wouldn't waste your time. Sorry.



  • AlbinCN

    If you can not read C# (and any VB developer should be able to as C# is different from VB mostly in keywords order and semicolon at the end), please convert that to VB using any free online translator available.

    Also please see this, item 11:

    http://www.danielmoth.com/Blog/2005/03/please-read-before-posting-to-ng.html



  • Vandal

    You're trying to get full directory path of what



  • Shuman Kibria

    I'm trying to retrieve a directory path of a file.

  • iamme

    Hi,

    try this

    using System.IO;


    FileInfo
    File = new FileInfo(FileFullPath);
    Directory = File.Directory.ToString();

    thanks



  • Getting file's directory