|
-
Sep 12th, 2002, 05:12 PM
#1
Thread Starter
Fanatic Member
Error problem
I have created a file association for my program. So if the user goes to the name of the file they saved using my program and open up the file from the run browse etc. my program will open and show the saved information. Now some times I receive this message when I open a file and sometimes I dont it will just open my program and show the saved work. This problem does not happen when I open my program directly using the exe, only when I open a file that is associated with my app. This is the error that I receive sometimes.
Run-time error '53':
File not found
Now if I try to open the file again it opens with no problem.
This is the code I am using in the form load declaration so that a user can open the saved information by opening a file that they saved with my program
VB Code:
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
cdbexpenditures.FileName = Command$
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
Can someone help me tell me how to stop this error message if anyone needs to see the app I can provide the exe and tell them what to do so they can see what the problem is
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 12th, 2002, 07:53 PM
#2
Frenzied Member
To ignore the error you can use.. on error resume next or on error Goto statement...
VB Code:
On Error Goto Hell
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
cdbexpenditures.FileName = Command$
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
Hell:
Exit Sub
-
Sep 12th, 2002, 08:00 PM
#3
Frenzied Member
Or try:
VB Code:
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
If Left$(sfilename, 1) = " " Then sfilename = Right$(sfilename, Len(sfilename) - 1)
If Left$(sfilename, 1) = """" Then sfilename = Mid$(sfilename, 2, Len(sfilename) - 2)
cdbexpenditures.FileName = Command$
' Where is your END IF?
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Sep 12th, 2002, 08:10 PM
#4
Thread Starter
Fanatic Member
Thanks guys I will try them both now
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 12th, 2002, 09:23 PM
#5
Thread Starter
Fanatic Member
The exit sub only quits the program and the other code still presents the same problem. How would I use the error resume next statement?
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 12th, 2002, 09:31 PM
#6
Frenzied Member
VB Code:
On Error Resume Next
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
cdbexpenditures.FileName = Command$
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
On Error Goto 0
' Plus you're missing an END IF.
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Sep 13th, 2002, 06:49 PM
#7
Thread Starter
Fanatic Member
Microbasic I tried the code when the error occurs the program just stops is there a way. I can just stop the error all together. Maybe I need to reconstruct the code any ideas?
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 13th, 2002, 07:15 PM
#8
Frenzied Member
VB Code:
On Error Resume Next
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
cdbexpenditures.FileName = Command$
Open sfilename For Input As #1
If Err = 0 Then
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
End If
Close #1
On Error Goto 0
' Plus you're missing an END IF.
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
Sep 14th, 2002, 09:35 AM
#9
Thread Starter
Fanatic Member
Okay thanks microbasics I will try this one. I have the end if in the project I didnt place on there because it does something else but here is the entire form load declaration this is what I have right now before Iam about to try the new code you submitted
VB Code:
Private Sub Form_Load()
On Error Resume Next
lbltitlebar.Width = Me.Width
Shape1.Width = Me.Width
If Len(Command$) > 0 Then
lblfilename.Caption = Command$
sfilename = Command$
cdbexpenditures.FileName = Command$
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
IntMax = list1.ListCount
For IntNext = 0 To IntMax - 1
Me.listone.AddItem Me.list1.List(IntNext)
Next
End If
intIndex1 = 0
On Error GoTo 0
End Sub
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 15th, 2002, 09:47 AM
#10
Thread Starter
Fanatic Member
Same error message
Iam still receiving the same error message at times. I dont know maybe its the code that Iam using. Is there any other code that if the user goes to the name of the file they saved using my program and open up the file from the run browse etc. my program will open and show the saved information. well i have the code that will open the information I just need for the check or something. Here is the opening code again. Please help been stuck on this problem for a week now.
VB Code:
lblfilename.Caption =cdbexpenditures.filetitle
sfilename = cdbexpenditures.filename
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 15th, 2002, 01:40 PM
#11
Thread Starter
Fanatic Member
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 15th, 2002, 01:44 PM
#12
The picture isn't missing
well... are you sure that Command$ has the correct path?
have you debbuged to see if sfilename is the correct path?
VB Code:
lblfilename.Caption =cdbexpenditures.filetitle
sfilename = cdbexpenditures.filename
msgbox dir(sfilename) 'if this is "" then the file doesn't exist.
Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Sep 17th, 2002, 01:45 PM
#13
Thread Starter
Fanatic Member
The problem is still continuing can someone please help. Maybe theres some other method of completeing this task I just cant figure it out.
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 17th, 2002, 02:18 PM
#14
Thread Starter
Fanatic Member
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 18th, 2002, 11:48 AM
#15
Thread Starter
Fanatic Member
any ideas
So can anyone help? Maybe if I attach the exe everyone can see what Iam talking about? Anyone can help?
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
-
Sep 18th, 2002, 12:40 PM
#16
Thread Starter
Fanatic Member
help please
Can someone help please. This is the only problem stopping me from finishing this program
Walter Richardson
Striver2000 Christian Productions
Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|