Link to home
Start Free TrialLog in
Avatar of rowternet
rowternet

asked on

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

Hi,

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
ASKER CERTIFIED SOLUTION
Avatar of theplonk
theplonk
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of B_Debasis
B_Debasis

Application.StartupPath  won't always work. Change your code to:

 abc = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) & "\GeoLocateMaintenance.htm"
Avatar of rowternet

ASKER

Hi, theplonk,

Thanks.
Including the content files made the difference.