PDA

View Full Version : Why won't the VB code recognize the path or file?!?!?!


singularity2006
10-27-2003, 07:33 AM
Aight, I'm trying to do a very basic thing, open a file for input....

Open "docs.txt" For Input As #1

Whenever I try to execute, it keeps saying file not found! And when I put in the full path, it says "path not found!"

What gives?!?!?! :thumbsdow

OC-NightHawk
10-27-2003, 08:30 PM
You have to program in the full address for the file. You can't just give the file name. If this file is stored in the same directory as the exe you can open it by doing this instead.

Open app.path & "\docs.txt" For Input As #1

singularity2006
10-28-2003, 05:35 PM
yah, I did that. Whenever I try to execute, it keeps saying file not found! And when I put in the full path, it says "path not found!"

oh yah, I also saved the VB form into a specific folder where the text file is located and it still gives me file not found errors.

So I have the file in f:\storage\file.txt
and I also have the VB form in f:\storage\

And in the link, I put in: Open "file.txt" For Input As #1
didn't work, says "File not found"

I tried Open "F:\storage\file.txt" For Input As #1
didn't work, says "path not found"

OC-NightHawk
10-28-2003, 07:02 PM
Originally posted by singularity2006
yah, I did that. Whenever I try to execute, it keeps saying file not found! And when I put in the full path, it says "path not found!"

oh yah, I also saved the VB form into a specific folder where the text file is located and it still gives me file not found errors.

So I have the file in f:\storage\file.txt
and I also have the VB form in f:\storage\

And in the link, I put in: Open "file.txt" For Input As #1
didn't work, says "File not found"

I tried Open "F:\storage\file.txt" For Input As #1
didn't work, says "path not found"

Does the file already exist at that directory?

Here is an example of what you are trying to do.

'set the setting file name
SettingFileName = App.Path & "\config.umc"

If UseDefaultSettings = True Then

'open the file for read only
Open SettingFileName For Input As #1

Input #1, ScreenWidth, ScreenHeight, ScreenDepth
Input #1, FarClipValue
Input #1, UseAA, SampleRate
Input #1, UseFog, FogUsed
Input #1, UseSpecular
Input #1, BGMusicVolumeLevel

Close #1

If Err.Number <> 0 Then

MsgBox Err.Description & ", " & Err.Number
Exit Sub

End If

End If

edit: sorry for the lack of formatting.

singularity2006
10-30-2003, 08:39 AM
yeaP, all the files exist where I have referenced them in the code.... my teacher said something about how sometimes the code is totally 100% legally entered, but something goes wrong w/ the form and u just gotta start from scratch. When I have time, I'll just create a new form and try the code again. Thanks for the tip.

CGTalk Moderation
01-16-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.