Results 1 to 6 of 6

Thread: This should be easier...

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 1999
    Location
    Louisville, KY
    Posts
    48

    This should be easier...

    I've been professionally developing in VB since version 3 and I am finally trying to make the move to .NET (2003). I'm at a loss on something that should be easy.

    I am working on a Pocket PC app that will store configuration data in an xml file.

    How do I...

    A). Get the application path?
    B). Open the file?

    I've tried this to get the current path but I get a "Not Supported" error:

    Dim sDir As String
    sDir = System.IO.Directory.GetCurrentDirectory.ToString()

    Any help would be appreciated.
    Seth

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    1.)
    Code:
        Console.WriteLine(System.IO.Directory.GetCurrentDirectory().ToString())
    2.) using the classes in the System.IO namespace (this is one way)
    Code:
    System.IO.FileStream s = new System.IO.FileStream("path", System.IO.FileMode.Open)
    Last edited by Lethal; Sep 18th, 2003 at 01:33 PM.

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 1999
    Location
    Louisville, KY
    Posts
    48
    I am writing this for Pocket PC so the console command won't work
    When I try this code snippet:
    MessageBox.Show(System.IO.Directory.GetCurrentDirectory().ToString())

    I get:

    "An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll"

    This is a Pocket PC application so I'm assuming that this isn't supported in the Mobile Framework???
    Seth

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Are you using VS.NET to build this app? Some functions are not supported in the compact framework.

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 1999
    Location
    Louisville, KY
    Posts
    48
    Yes, I'm using VS.NET 2003.
    Seth

  6. #6
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244

    I could be totally off here, but...

    In my little experience with PocketPC, there is no "traditional" directory structure, because there are no "drives", only the machine.

    for example, a path on PocketPC would be
    \My Documents
    (no drive letter)

    My guess is that certain IO operations aren't supported as a result

    Here's a shot (pseudocode)
    VB Code:
    1. Dim asm As System.Reflection.Assembly
    2.  
    3. asm = System.Reflection.GetExecutingAssembly
    4. sDir = asm.ExecutablePath

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width