Results 1 to 16 of 16

Thread: [RESOLVED] [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Resolved [RESOLVED] [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    When i Debug in the Code in VB environment No error But when i Build The Realse Exe and Try to Run it i Got this Error:
    an exception "system.io.filenotfoundexception' has occurred in file.exe


    In this is my Code:
    VB Code:
    1. Public Class Form1
    2.     Inherits System.Windows.Forms.Form
    3.     Dim s() As String = {"7", "286", "200", "176", "120", "165", "206", "75", "129", "109", "123", "111", "43", "52", "99", "128", "111", "110", _
    4. "98", "135", "112", "78", "118", "64", "77", "227", "93", "88", "69", "69", "34", "30", "73", "54", "45", "83", "182", "88", _
    5. "75", "85", "54", "53", "89", "59", "37", "35", "38", "29", "18", "45", "60", "49", "62", "55", "78", "96", "29", "22", "24", _
    6. "13", "14", "11", "11", "18", "12", "12", "30", "52", "52", "44", "28", "28", "20", "56", "40", "31", "50", "40", "46", "42", _
    7. "29", "19", "36", "25", "22", "17", "19", "26", "30", "20", "15", "21", "11", "8", "8", "19", "5", "8", "8", "11", "11", "8", _
    8. "3", "9", "5", "4", "7", "3", "6", "3", "5", "4", "5", "6"}
    9.     Dim Link As String = "http://quran.muslim-web.com/tafseer/"
    10.     Dim Mofaser As String
    11. '''''''
    12.  
    13.     Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
    14.         cmbSoura.SelectedIndex = 0
    15.         cmbMofaser.SelectedIndex = 0
    16.     End Sub
    17. '''''''''''''''''
    18.  
    19.     Private Sub cmbSoura_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbSoura.SelectedIndexChanged
    20.         cmbAya.Items.Clear()
    21.         Dim i As Integer
    22.         For i = 1 To s(cmbSoura.SelectedIndex)
    23.             cmbAya.Items.Add(i.ToString)
    24.         Next
    25.         cmbAya.SelectedIndex = 0
    26.     End Sub
    27.  
    28.     Private Sub cmbMofaser_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbMofaser.SelectedIndexChanged
    29.         Select Case cmbMofaser.SelectedIndex
    30.             Case 0
    31.                 Mofaser = "KATHEER"
    32.             Case 1
    33.                 Mofaser = "GALALEEN"
    34.             Case 2
    35.                 Mofaser = "TABARY"
    36.             Case 3
    37.                 Mofaser = "KORTOBY"
    38.         End Select
    39.     End Sub
    40.  
    41.     Private Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click
    42.         Try
    43.             Dim iSouraNo As Integer = cmbSoura.SelectedIndex + 1
    44.             Dim iAyaNo As Integer = cmbAya.Text
    45.             wbrShow.Navigate(Link & Mofaser & "/" & iSouraNo.ToString("000") & iAyaNo.ToString("000") & ".html")
    46.         Catch ex As Exception
    47.             ';;;;;;;;
    48.         End Try
    49.     End Sub
    50. End Class

    What is the wrong ?
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  2. #2
    Member
    Join Date
    Mar 2006
    Posts
    45

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    I'm just guessing here, but as the exception suggests it means that there is a file you are trying to access that does not exist.

    My best guesstimate (unless there is another place in the code where you are trying to access a file) is that the code wbrShow.Navigate(...) is generating that error. I'd print out the result from this - (Link & Mofaser & "/" & iSouraNo.ToString("000") & iAyaNo.ToString("000") & ".html") - in a message box and check that it is a valid link....

    EDIT: I guess you should also check that any files that you are accessing are in the Release directory as well as the debug directory...
    VB.2003

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    The Code not access any file
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  4. #4
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Wouldnt you get errors at this line:
    VB Code:
    1. Dim iAyaNo As Integer = cmbAya.Text
    You are trying to assign a string variable to an integer, which is a no-no.

    You would probably benefit from turning Option Strict On and Option Explicit On, because if you have it on, it will show an error in the IDE when you try to do that... with cute little blue squigglies
    Last edited by gigemboy; Mar 31st, 2006 at 01:10 AM.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    You say that your app throws an exception. What are you attempting to do when this happens? That should give you a clue as to where in the code the exception is thrown.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    When i Run The Exe The Error Come So I Dont Attempt Anything, I think this Mean In Form Loading Event.
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Quote Originally Posted by gigemboy
    Wouldnt you get errors at this line:
    VB Code:
    1. Dim iAyaNo As Integer = cmbAya.Text
    You are trying to assign a string variable to an integer, which is a no-no.

    You would probably benefit from turning Option Strict On and Option Explicit On, because if you have it on, it will show an error in the IDE when you try to do that... with cute little blue squigglies
    I did Not Get The Error :s

    And I Used this Way to get the String format ("000") to get the Numbers as 001, 002, 033, 125, etc .
    Because I Tried Format(cmbAya.Text, "000") but it doesnt work
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Shall I Say There is No Solution for this problem ?
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Of course there's a solution. It's hard for us to diagnose it without being able to see the app in action. You need to add some logging to your app so that you can track what it's doing and see exactly where it was up to when the issue occurred.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Quote Originally Posted by jmcilhinney
    You need to add some logging to your app so that you can track what it's doing and see exactly where it was up to when the issue occurred.
    Sorry For Bother but what did you mean i need to add some logging. .. What is this?

    And this is the Code attached
    Attached Files Attached Files
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Logging means to keep a log, as in your app needs to record its activities somewhere. I believe that there are some diagnostic logging features built in but I've never used them. You could use the event log but I don't think that would be appropriate for this situation. A simple option would be to just write to a text file. You could write a line at the beginning and end of each constructor, in your Main method, etc. Once you know which method was enetered and not exited then you can look more closely at that method, perhaps adding a log entry after each line if necessary.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  12. #12
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    The error is probably because it cant find the interop dll's inside of the directory that it is sitting in...

    I built the program, in release mode, and it ran fine.

    When you "build a release", are you creating a setup project?? You have to create a setup project by making a setup project, then it will detect the dependencies, and you can change the "copylocal" property to "true" for those dll's...

    ***EDIT - you are probably clicking on what is in the Release folder in the obj folder. You shouldn't do that. When you change it to "release", it rebuilds everything inside of the bin folder, so just run the exe from the bin folder.
    Last edited by gigemboy; Apr 1st, 2006 at 01:11 AM.

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    Many Thanx To Gigem And you John

    The Problem Was Resolved But i Have 1 Q


    So When I Send this To Users.
    Shall I Enclude The Dlls and put them in the same dir of the exe and Register them ?
    Last edited by _Conan_; Apr 1st, 2006 at 03:03 AM.
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  14. #14
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    You add a new setup project to your solution. The setup project should detect the dependencies and give you options to register, etc when you view the dll's properties... searching the forum for "setup project" or something to that matter will pull several examples...

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Nov 2005
    Posts
    153

    Re: [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    & BIG THANX TO GIGEMBOY, I wish to Kiss You But afraid Maybe Others Will think I am GAY :|
    This is The Prophet MOHAMMAD!
    =======================
    My SuperMen:
    RhinoBull, gigemboy, jmcilhinney, |2eM!x, Edneeis and Hack

  16. #16
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: [RESOLVED] [02/03] an exception "system.io.filenotfoundexception' has occurred in file.exe

    awwww how cute

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