Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 03-25-09   #1 (permalink)
AMD Overclocker
 
MadCatMk2's Avatar
 
intel nvidia

Join Date: May 2006
Location: Greece
Posts: 1,975

Rep: 202 MadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by many
Unique Rep: 158
Folding Team Rank: 203
Trader Rating: 0
Default Visual Studio 2008 and Environment.CurrentDirectory

Warning: I have never, ever read a single tutorial or book on Visual Studio Express 2008.
However, I'm making a small application in it.

In the process of making it a tad more user friendly I've decided to make it find out where it is located on its own.

I'm trying to use this:
Code:
Dim textFileStream As New IO.FileStream(Environment.CurrentDirectory & "\directory\blabla\tadah.txt", IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite, IO.FileShare.None)
It seems however that "Environment.CurrentDirectory" (or anything similar I've tried so far) does not work in VB2008:
http://weblogs.asp.net/joshclose/arc...udio-2008.aspx

Porting the whole thing to VS2008 would be a real PITA at this point.

If someone could explain what I should do in uber-simple steps it would be great

System: It folds.
CPU
E8500 @ 3.58 - 1.12v
Motherboard
Penryn1600SLI (650i)
Memory
4 GB
Graphics Card
HD4850 & 8800GT
Hard Drive
Four of 'em.
Power Supply
PCP&C Silencer 750W
Case
Coolermaster HAF932
CPU cooling
Xigmatek HDT-S963
GPU cooling
Stock
OS
Binblows 7
Monitor
4612 FA (IPS Pwnage)
Overclock.net - 2009 Chimp Challenge Champions 1 Million+ Folding at Home points
MadCatMk2 is offline I fold for Overclock.net   Reply With Quote
Old 03-25-09   #2 (permalink)
News Fiend
 
kyotejones's Avatar
 
intel nvidia

Join Date: Mar 2007
Posts: 222

Rep: 32 kyotejones is acknowledged by some
Unique Rep: 29
Trader Rating: 0
Default

http://msdn.microsoft.com/en-us/libr...ry(VS.71).aspx
Directory.GetCurrentDirectory()
__________________
System: SCUD
CPU
Pentium C2D 2.4GHz
Motherboard
ASUS P5N32-E SLI
Memory
2x1Gb Balistix
Graphics Card
GeForce 7950 GT
Sound Card
SupremeFX (ADI 1988b)
Power Supply
ENERMAX Liberty 620W
Case
RAIDMAX SMILODON ATX
CPU cooling
ARCTIC COOLING Freezer 7
GPU cooling
Passive Heat Sink + CPU Fan
OS
Win XP Pro
Monitor
2x20" Samsung SyncMaster
kyotejones is offline   Reply With Quote
Old 03-25-09   #3 (permalink)
AMD Overclocker
 
MadCatMk2's Avatar
 
intel nvidia

Join Date: May 2006
Location: Greece
Posts: 1,975

Rep: 202 MadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by many
Unique Rep: 158
Folding Team Rank: 203
Trader Rating: 0
Default

Quote:
Originally Posted by kyotejones View Post
System.IO.DirectoryNotFoundException: Could not find a part of the path 'O:\Users\Administrator\AppData\Local\Apps\2.0\HKC KL4NQ.CGD\BE1L0D1C.W20\wind..tion_9e05d0f55a9e6a30 _0001.0000_d0bec19d65c58427\

System: It folds.
CPU
E8500 @ 3.58 - 1.12v
Motherboard
Penryn1600SLI (650i)
Memory
4 GB
Graphics Card
HD4850 & 8800GT
Hard Drive
Four of 'em.
Power Supply
PCP&C Silencer 750W
Case
Coolermaster HAF932
CPU cooling
Xigmatek HDT-S963
GPU cooling
Stock
OS
Binblows 7
Monitor
4612 FA (IPS Pwnage)
Overclock.net - 2009 Chimp Challenge Champions 1 Million+ Folding at Home points
MadCatMk2 is offline I fold for Overclock.net   Reply With Quote
Old 03-25-09   #4 (permalink)
News Fiend
 
kyotejones's Avatar
 
intel nvidia

Join Date: Mar 2007
Posts: 222

Rep: 32 kyotejones is acknowledged by some
Unique Rep: 29
Trader Rating: 0
Default

It would help if you posted the code. As far as the error goes it means the directory does not exist.
__________________
System: SCUD
CPU
Pentium C2D 2.4GHz
Motherboard
ASUS P5N32-E SLI
Memory
2x1Gb Balistix
Graphics Card
GeForce 7950 GT
Sound Card
SupremeFX (ADI 1988b)
Power Supply
ENERMAX Liberty 620W
Case
RAIDMAX SMILODON ATX
CPU cooling
ARCTIC COOLING Freezer 7
GPU cooling
Passive Heat Sink + CPU Fan
OS
Win XP Pro
Monitor
2x20" Samsung SyncMaster
kyotejones is offline   Reply With Quote
Old 03-25-09   #5 (permalink)
Programmer
 
xtascox's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: Dallas, PA
Posts: 779

Rep: 37 xtascox is acknowledged by some
Unique Rep: 36
Trader Rating: 1
Default

Forgive if I'm wrong (I haven't written anything in VB since Visual Studio 6 was top of the line) but I thought VB already works in the directory it is executed in.

Unless I'm completely missing the point here. It's been a long day here at work

EDIT: Try
Code:
App.Path
That may also include the executable in the path but you can strip that part out of the string.
__________________

System: SVT
CPU
Q6600 @ 3.2ghz 1600fsb
Motherboard
EVGA 780i FTW
Memory
4GB OCZ Platimum
Graphics Card
2X EVGA 8800GTS 512
Hard Drive
160GB Seagate Barracuda 7200 SATA
Sound Card
Onboard Realtek ALC883
Power Supply
CORSAIR 750TX
Case
Chenming 901A
CPU cooling
Arctic Freezer 7 + Arctic Silver 5
GPU cooling
Stock Heatsink and fan
OS
Windows Vista Ultimate 64
Monitor
Hanns-G 22" LCD

Last edited by xtascox : 03-25-09 at 02:08 PM
xtascox is online now   Reply With Quote
Old 03-25-09   #6 (permalink)
AMD Overclocker
 
MadCatMk2's Avatar
 
intel nvidia

Join Date: May 2006
Location: Greece
Posts: 1,975

Rep: 202 MadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by many
Unique Rep: 158
Folding Team Rank: 203
Trader Rating: 0
Default

Quote:
Originally Posted by kyotejones View Post
It would help if you posted the code. As far as the error goes it means the directory does not exist.
It's looking in the wrong directory. The program is executed from a folder in the desktop, but it's looking in the place it states.

Edit: There's not much else to the code relevant to this, just
Code:
Dim myFileWriter As New IO.StreamWriter(textFileStream)
and I start replacing lines.

System: It folds.
CPU
E8500 @ 3.58 - 1.12v
Motherboard
Penryn1600SLI (650i)
Memory
4 GB
Graphics Card
HD4850 & 8800GT
Hard Drive
Four of 'em.
Power Supply
PCP&C Silencer 750W
Case
Coolermaster HAF932
CPU cooling
Xigmatek HDT-S963
GPU cooling
Stock
OS
Binblows 7
Monitor
4612 FA (IPS Pwnage)
Overclock.net - 2009 Chimp Challenge Champions 1 Million+ Folding at Home points
MadCatMk2 is offline I fold for Overclock.net   Reply With Quote
Old 03-25-09   #7 (permalink)
Programmer
 
xtascox's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: Dallas, PA
Posts: 779

Rep: 37 xtascox is acknowledged by some
Unique Rep: 36
Trader Rating: 1
Default

Did you try App.Path?
__________________

System: SVT
CPU
Q6600 @ 3.2ghz 1600fsb
Motherboard
EVGA 780i FTW
Memory
4GB OCZ Platimum
Graphics Card
2X EVGA 8800GTS 512
Hard Drive
160GB Seagate Barracuda 7200 SATA
Sound Card
Onboard Realtek ALC883
Power Supply
CORSAIR 750TX
Case
Chenming 901A
CPU cooling
Arctic Freezer 7 + Arctic Silver 5
GPU cooling
Stock Heatsink and fan
OS
Windows Vista Ultimate 64
Monitor
Hanns-G 22" LCD
xtascox is online now   Reply With Quote
Old 03-25-09   #8 (permalink)
AMD Overclocker
 
MadCatMk2's Avatar
 
intel nvidia

Join Date: May 2006
Location: Greece
Posts: 1,975

Rep: 202 MadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by many
Unique Rep: 158
Folding Team Rank: 203
Trader Rating: 0
Default

Quote:
Originally Posted by xtascox View Post
Did you try App.Path?
It's not recognized properly, nor is AppPath for some reason.. =/

System: It folds.
CPU
E8500 @ 3.58 - 1.12v
Motherboard
Penryn1600SLI (650i)
Memory
4 GB
Graphics Card
HD4850 & 8800GT
Hard Drive
Four of 'em.
Power Supply
PCP&C Silencer 750W
Case
Coolermaster HAF932
CPU cooling
Xigmatek HDT-S963
GPU cooling
Stock
OS
Binblows 7
Monitor
4612 FA (IPS Pwnage)
Overclock.net - 2009 Chimp Challenge Champions 1 Million+ Folding at Home points
MadCatMk2 is offline I fold for Overclock.net   Reply With Quote
Old 03-25-09   #9 (permalink)
Programmer
 
xtascox's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: Dallas, PA
Posts: 779

Rep: 37 xtascox is acknowledged by some
Unique Rep: 36
Trader Rating: 1
Default

Check the properties and see if there is a working folder.
__________________

System: SVT
CPU
Q6600 @ 3.2ghz 1600fsb
Motherboard
EVGA 780i FTW
Memory
4GB OCZ Platimum
Graphics Card
2X EVGA 8800GTS 512
Hard Drive
160GB Seagate Barracuda 7200 SATA
Sound Card
Onboard Realtek ALC883
Power Supply
CORSAIR 750TX
Case
Chenming 901A
CPU cooling
Arctic Freezer 7 + Arctic Silver 5
GPU cooling
Stock Heatsink and fan
OS
Windows Vista Ultimate 64
Monitor
Hanns-G 22" LCD
xtascox is online now   Reply With Quote
Old 03-25-09   #10 (permalink)
AMD Overclocker
 
MadCatMk2's Avatar
 
intel nvidia

Join Date: May 2006
Location: Greece
Posts: 1,975

Rep: 202 MadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by manyMadCatMk2 is acknowledged by many
Unique Rep: 158
Folding Team Rank: 203
Trader Rating: 0
Default

Quote:
Originally Posted by xtascox View Post
Check the properties and see if there is a working folder.
There's none stated, but that would only work for my computer. If the installation is done somewhere else it wouldn't work, right?

Edit: Application.StartupPath has the same effect as above.

System: It folds.
CPU
E8500 @ 3.58 - 1.12v
Motherboard
Penryn1600SLI (650i)
Memory
4 GB
Graphics Card
HD4850 & 8800GT
Hard Drive
Four of 'em.
Power Supply
PCP&C Silencer 750W
Case
Coolermaster HAF932
CPU cooling
Xigmatek HDT-S963
GPU cooling
Stock
OS
Binblows 7
Monitor
4612 FA (IPS Pwnage)
Overclock.net - 2009 Chimp Challenge Champions 1 Million+ Folding at Home points

Last edited by MadCatMk2 : 03-25-09 at 02:40 PM
MadCatMk2 is offline I fold for Overclock.net   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 09:47 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.15327 seconds with 9 queries