Results 1 to 4 of 4

Thread: [RESOLVED] [2005 Express] App.Config Filepaths

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    8

    Resolved [RESOLVED] [2005 Express] App.Config Filepaths

    Hello,

    I have tried using
    Code:
       System.Diagnostics.Process.Start(My.Settings.pathhmt)
    Where pathhmt is a path to an EXE file, but unfortunatly the file does not load and I get an exception.

    How can I launch a file with the filepath referenced in the app.config?

    Thanks in advance.

    Ajhayter
    Last edited by Ajhayter; Oct 4th, 2006 at 12:37 PM. Reason: oops title

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [2005 Express] App.Config Filepaths

    What kind of Exception do you get?
    Always be specific
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    8

    Re: [2005 Express] App.Config Filepaths

    Quote Originally Posted by ComputerJy
    What kind of Exception do you get?
    Always be specific
    Just a file cannot be found in the debug.

    Seems to be it just searches for "my.settings.pathhmt" rather than the filepath that "pathhmt" references.

    Any ideas?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005 Express] App.Config Filepaths

    Have you actually checked what that setting contains? The code you've provided will work fine as long as the setting contains a valid file path. If it doesn't then of course you're going to get an exception. The only way that that code would search for a file named "My.Settings.pathhmt" is if you'd wrapped it in double quotes, which you haven't according to your post.
    VB Code:
    1. If IO.File.Exists(My.Settings.patthmt) Then
    2.     MessageBox.Show("File found: " & My.Settings.patthmt)
    3. Else
    4.     MessageBox.Show("File not found: " & My.Settings.patthmt)
    5. End If
    Don't just assume that everything you think is happening is happening. Test it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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