Mortious Posted July 7, 2003 Posted July 7, 2003 Im going from VB6.0 to .NET and have a couple of questions. My first one (and the only one Ill ask right now) is how do I handle flat text file IO. I have seen the examples below of this and those definatly help, but I don't want to hard code the path of the file. In VB 6 I could use app.path with the rest of the file information to grab it, is there a .NET variance of app.path? BTW I don't have the MSDN help libraries installed yet (waiting on the help desk guys to do that). Thanks. Quote
*Experts* mutant Posted July 7, 2003 *Experts* Posted July 7, 2003 Now you use this instead of app.path: Applicatoin.ExecutablePath :) Quote
JCreationsInc Posted July 10, 2003 Posted July 10, 2003 I use this class This is the class I use to get the application path and also the exe name: 'Call it like so Dim AppPath as New AppPath() 'Here is the class Public Class AppPath Private mAppPath As String Private mExeName As String Public ReadOnly Property DirPath() 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 Note: the path that is returned is to the "bin" directory in your project directory. Quote When in doubt.... use the sledge Hammer!!
Leaders dynamic_sysop Posted July 11, 2003 Leaders Posted July 11, 2003 as mutant was saying Application.ExecutablePath , that returns the path and exe name all in 1 line : MessageBox.Show(Application.ExecutablePath) to get just the start up directory ( minus the exe name ) this works : MessageBox.Show(Application.StartupPath) Quote
JCreationsInc Posted July 11, 2003 Posted July 11, 2003 doh my code is useless, oooohhh :mad: Quote When in doubt.... use the sledge Hammer!!
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.