Hello! Ive just switched from VB 6 to .Net and i feel like a complete stranger to VB at the moment :lol:
In VB6 u could write app.path to retrieve the apps path.. but what to write in .Net ? Cheers
Printable View
Hello! Ive just switched from VB 6 to .Net and i feel like a complete stranger to VB at the moment :lol:
In VB6 u could write app.path to retrieve the apps path.. but what to write in .Net ? Cheers
VB Code:
Application.StartupPath
Try:
VB Code:
Application.StartupPath
aah thx guys!
If your thread is resolved, you can go to the top under "thread tools" and mark it as "resolved" :)
If it's not resolved, you can throw a box of apple juice at gigemboy.
mmm.. apple juice.... my favorite :)
this wud also work and it is also sometimes better
but the reason why it's better is becuase you can do stuff likeVB Code:
Environment.CurrentDirectory
VB Code:
Environment.MachineName Environment.OSVersion Environment.UserName
and it get's better for stuff like desktop folder
VB Code:
Environment.SpecialFolder.Desktop() Environment.SpecialFolder.Favorites() Environment.SpecialFolder.MyComputer() Environment.SpecialFolder.MyDocuments()
it's pretty cool and i would recomend it
Environment.CurrentDirectory is almost always a BAD choice in this circumstance. Other applications can change the current directory.
Bill
Yes sir, conipto is correct. Environment.Currentdirectory will not always return the application directory in ever instance. It is a windows system variable, and this can change depending on the other programs you have running as well. I was using Environment.Currentdirectory in some of my early programs and started getting errors when working with other programs as well, it would return some other directory that I had chosen in a file save dialog or what not in a different program. So, stick with application.startuppath...