Results 1 to 16 of 16

Thread: Error problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536

    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:
    1. If Len(Command$) > 0 Then
    2.   lblfilename.Caption = Command$
    3.   sfilename = Command$
    4.   cdbexpenditures.FileName = Command$
    5.  
    6.  
    7.   Open sfilename For Input As #1
    8.   Do While Not EOF(1)
    9.     Line Input #1, sfilename
    10.     strlistdata = Split(sfilename, "::")
    11.     list1.AddItem strlistdata(0)
    12.     List2.AddItem strlistdata(1)
    13.     List3.AddItem strlistdata(2)
    14.   Loop
    15.   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!

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011
    To ignore the error you can use.. on error resume next or on error Goto statement...
    VB Code:
    1. On Error Goto Hell
    2. If Len(Command$) > 0 Then
    3.   lblfilename.Caption = Command$
    4.   sfilename = Command$
    5.   cdbexpenditures.FileName = Command$
    6.  
    7.  
    8.   Open sfilename For Input As #1
    9.   Do While Not EOF(1)
    10.     Line Input #1, sfilename
    11.     strlistdata = Split(sfilename, "::")
    12.     list1.AddItem strlistdata(0)
    13.     List2.AddItem strlistdata(1)
    14.     List3.AddItem strlistdata(2)
    15.   Loop
    16.   Close #1
    17. Hell:
    18.  Exit Sub

  3. #3
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Or try:

    VB Code:
    1. If Len(Command$) > 0 Then
    2.   lblfilename.Caption = Command$
    3.   sfilename = Command$
    4.   If Left$(sfilename, 1) = " " Then sfilename = Right$(sfilename, Len(sfilename) - 1)
    5.   If Left$(sfilename, 1) = """" Then sfilename = Mid$(sfilename, 2, Len(sfilename) - 2)
    6.   cdbexpenditures.FileName = Command$
    7. ' Where is your END IF?
    8.  
    9.   Open sfilename For Input As #1
    10.   Do While Not EOF(1)
    11.     Line Input #1, sfilename
    12.     strlistdata = Split(sfilename, "::")
    13.     list1.AddItem strlistdata(0)
    14.     List2.AddItem strlistdata(1)
    15.     List3.AddItem strlistdata(2)
    16.   Loop
    17.   Close #1


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    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!

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    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!

  6. #6
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    VB Code:
    1. On Error Resume Next
    2. If Len(Command$) > 0 Then
    3.   lblfilename.Caption = Command$
    4.   sfilename = Command$
    5.   cdbexpenditures.FileName = Command$
    6.  
    7.  
    8.   Open sfilename For Input As #1
    9.   Do While Not EOF(1)
    10.     Line Input #1, sfilename
    11.     strlistdata = Split(sfilename, "::")
    12.     list1.AddItem strlistdata(0)
    13.     List2.AddItem strlistdata(1)
    14.     List3.AddItem strlistdata(2)
    15.   Loop
    16.   Close #1
    17. On Error Goto 0
    18. ' Plus you're missing an END IF.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    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!

  8. #8
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    VB Code:
    1. On Error Resume Next
    2. If Len(Command$) > 0 Then
    3.   lblfilename.Caption = Command$
    4.   sfilename = Command$
    5.   cdbexpenditures.FileName = Command$
    6.  
    7.  
    8.   Open sfilename For Input As #1
    9.   If Err = 0 Then
    10.     Do While Not EOF(1)
    11.       Line Input #1, sfilename
    12.       strlistdata = Split(sfilename, "::")
    13.       list1.AddItem strlistdata(0)
    14.       List2.AddItem strlistdata(1)
    15.       List3.AddItem strlistdata(2)
    16.     Loop
    17.   End If
    18.   Close #1
    19. On Error Goto 0
    20. ' Plus you're missing an END IF.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    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:
    1. Private Sub Form_Load()
    2.  
    3. On Error Resume Next
    4. lbltitlebar.Width = Me.Width
    5. Shape1.Width = Me.Width
    6.  
    7.  
    8.  
    9.  
    10. If Len(Command$) > 0 Then
    11.   lblfilename.Caption = Command$
    12.   sfilename = Command$
    13.   cdbexpenditures.FileName = Command$
    14.  
    15.  
    16.   Open sfilename For Input As #1
    17.   Do While Not EOF(1)
    18.     Line Input #1, sfilename
    19.     strlistdata = Split(sfilename, "::")
    20.     list1.AddItem strlistdata(0)
    21.     List2.AddItem strlistdata(1)
    22.     List3.AddItem strlistdata(2)
    23.   Loop
    24.   Close #1
    25.  
    26.  
    27.   IntMax = list1.ListCount
    28.  
    29. For IntNext = 0 To IntMax - 1
    30.  
    31. Me.listone.AddItem Me.list1.List(IntNext)
    32.  
    33. Next
    34. End If
    35.  
    36.  
    37.  
    38.  
    39. intIndex1 = 0
    40.  
    41.  
    42. On Error GoTo 0
    43.  
    44.  
    45.  
    46.  
    47.  
    48. 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!

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536

    Unhappy 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:
    1. lblfilename.Caption =cdbexpenditures.filetitle
    2.   sfilename = cdbexpenditures.filename  
    3. Open sfilename For Input As #1
    4.   Do While Not EOF(1)
    5.     Line Input #1, sfilename
    6.     strlistdata = Split(sfilename, "::")
    7.     list1.AddItem strlistdata(0)
    8.     List2.AddItem strlistdata(1)
    9.     List3.AddItem strlistdata(2)
    10.   Loop
    11.   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!

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    So can someone help me
    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!

  12. #12
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    well... are you sure that Command$ has the correct path?

    have you debbuged to see if sfilename is the correct path?

    VB Code:
    1. lblfilename.Caption =cdbexpenditures.filetitle
    2.   sfilename = cdbexpenditures.filename  
    3.  
    4. msgbox dir(sfilename) 'if this is "" then the file doesn't exist.
    5. Open sfilename For Input As #1
    6.   Do While Not EOF(1)
    7.     Line Input #1, sfilename
    8.     strlistdata = Split(sfilename, "::")
    9.     list1.AddItem strlistdata(0)
    10.     List2.AddItem strlistdata(1)
    11.     List3.AddItem strlistdata(2)
    12.   Loop
    13.   Close #1
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    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!

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    Can anyone 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!

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536

    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!

  16. #16

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536

    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
  •  



Click Here to Expand Forum to Full Width