07-03-2011, 03:30 AM
(This post was last modified: 07-03-2011, 03:31 AM by AceInfinity.)
Code:
If Not I.ProcessName = Application.ExecutablePath.Split("\")(Application.ExecutablePath.Split("\").Length - 1).Split(".")(0) Then
you didn't need all that extra typing lol. This could have been used as well:
Code:
Path.GetFileName(Application.ExecutablePath)
Code:
IO.Path.GetFileName(Application.ExecutablePath)
Or you could have just split it at the last index of "\" instead, also it's only accurate for form applications. But it wouldn't work for a module or a service.
But this is only accurate for windows form applications (executables), and it wouldn't be very good to use for a service or a module.
Use this instead of the code above:
Code:
Dim AppProcess As String = Process.GetCurrentProcess.MainModule.FileName