September 27, 2009

Launch Application using vb code

I think I misread your question. If it's just a normal VB application, just use App.Path to get the application path. There is one trick though. If the path is "C:" there will be no "\", unlike other paths (e.g. "C:\Program Files\"). To compensate for this, I usually create another variable (call it AppPath for instance), which I set as follows:

Dim AppPath as String
AppPath = App.Path
if right(AppPath, 1) <> "\" then
AppPath = AppPath & "\"
end if

AppPath can then be used in place of your $GetDirectory$ for instance:
Process.Start(AppPath & "programname.exe")
Disqus Comments