Application.executablepath - to specify the path for the htm file


When debugging my application, i call this method which loads the webbrowser and this in turn loads the javascript file.(First 2 lines)
When i create a set up & deployment project, i assume, i have to use the application.executable path i guess. So, i replaced the exe with the htm file here.
But it does not load the webbrowser and the map.
Why is the map not loading in run mode?
Public Sub LoadMap()

      'Debug mode - works (Testing purposes, i give this path to the html file.) . In Debug mode, application.executablepath also works.
         'Me.WebBrowser1.Url = New Uri("D:\App Folder\Test_TransMgr\TRMgrProject\GeoLocateMaintenance.htm")
         'Me.WebBrowser1.ObjectForScripting = Me
      'Running Exe - Fails
         Dim abc As String = Nothing
         abc = Application.ExecutablePath.Replace("TRMgrProject.EXE", "GeoLocateMaintenance")
               'abc = Application.StartupPath.Replace("bin\Debug\", "GeoLocateMaintenance")
              Me.WebBrowser1.Url = New Uri(abc)
               Me.WebBrowser1.ObjectForScripting = Me
    End Sub

Thanks in Advance
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Make sure your file is being output to the assembly's directory. You can change the "Copy to Output Directory" property of the html file in the solution explorer. In your setup project make sure you add the content files (which are marked as "Content" in the solution explorer) to be copied to the application folder.

Then you should be able to just use the application startup path.

Dim abc As String
abc = Application.StartupPath & "\GeoLocateMaintenance.htm"

Me.TextBox1.Text = abc 'Ignore this line. I used a textbox to confirm the path.
Me.WebBrowser1.Url = New Uri(abc)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Application.StartupPath  won't always work. Change your code to:

 abc = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) & "\GeoLocateMaintenance.htm"
rowternetAuthor Commented:
Hi, theplonk,

Including the content files made the difference.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.