17-10-12, 10:51 PM
كاتب الموضوع : AhmedEssawy
كود :
Option Explicit
Option Strict
Imports System
Imports System.IO
Class ThisApp
Private mAppPath As String
Private mExeName As String
Public ReadOnly Property AppPath() As String
Get
Return mAppPath
End Get
End Property
Public ReadOnly Property ExeName() As String
Get
Return mExeName
End Get
End Property
Public Sub New()
Dim p As Path
Try
mAppPath = System.Reflection.Assembly.GetExecutingAssembly.Location
mExeName = Dir(mAppPath)
mAppPath = p.GetFullPath((Left(mAppPath, (Len(mAppPath) - Len(mExeName)))))
Catch
MsgBox(Err.Description, MsgBoxStyle.Critical, "Error!")
End Try
End Sub
End Class
Module modMain
Sub Main()
Dim MyApp As ThisApp = New ThisApp()
MsgBox(MyApp.AppPath, MsgBoxStyle.Information, "App Path")
MsgBox(MyApp.ExeName, MsgBoxStyle.Information, "Exe Name")
End Sub
End Module