none
I need desperate help with Visual Basic Error! What do I do to fix the following error:? Filenotfoundexceptionnotfound was unhandled It's not finding an image...but the image IS there.... Have a look at my code please: RRS feed

  • Question

  • Filenotfoundexceptionnotfound was unhandled

    It's not finding an image...but the image IS there....

    Have a look at my code please:

    Public Class frmford
    Dim Car(5) As ListOfCars
    Private Sub grpbxford_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles grpbxford.Enter

    End Sub

    Private Sub frmford_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Car(0) = New ListOfCars

    Car(0).Make = "Ford"
    Car(0).Model = "Ford GT"
    Car(0).Doors = "2"
    Car(0).CarPicture = "Ford GT"

    Car(1) = New ListOfCars
    Car(1).Make = "Ford"
    Car(1).Model = "Ford Mustang"
    Car(1).Doors = "4"
    Car(1).CarPicture = "Ford Mustang GT 520"

    Car(2) = New ListOfCars
    Car(2).Make = "Ford"
    Car(2).Model = "Ford Raptor"
    Car(2).Doors = "4"
    Car(2).CarPicture = "Ford Raptor"

    Car(3) = New ListOfCars
    Car(3).Make = "Ford"
    Car(3).Model = "Ford Focus"
    Car(3).Doors = "4"
    Car(3).CarPicture = "Ford Focus"

    Car(4) = New ListOfCars
    Car(4).Make = "Ford"
    Car(4).Model = "Ford F150"
    Car(4).Doors = "4"
    Car(4).CarPicture = "Ford F150"

    Car(5) = New ListOfCars
    Car(5).Make = "Ford"
    Car(5).Model = "Ranger"
    Car(5).Doors = "4"
    Car(5).CarPicture = "Ford Ranger"





    End Sub

    Private Sub trbslider_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbslider.Scroll
    ' Get the index of the current value of the track bar -1
    Dim CurPos As Int16 = trbslider.Value

    'Based on the current index, retrieve the values of the
    ' current car and assign each to the corresponding control
    txtmake.Text = Car(CurPos).Make
    txtmodel.Text = Car(CurPos).Model
    txtdoors.Text = Car(CurPos).Doors.ToString()
    picbxcarpic.Image = Drawing.Image.FromFile(Car(CurPos).CarPi…

    End Sub

    Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click
    Close()
    End Sub
    End Class
    Tuesday, December 8, 2009 6:39 PM

Answers

  • Place a new text document on your desktop and double click it.  Write the string in your FromFile statement to the output window and copy and paste it into the the text dcoument.  Navigate to the file in explorer, copy the path from the explorer address box and paste below the text in the text document.  Add a "/" and copy and paste the filename.  Compare the two lines of text to find the difference and correct the file name or your code as approprate.
    Tuesday, December 8, 2009 6:59 PM

All replies

  • Place a new text document on your desktop and double click it.  Write the string in your FromFile statement to the output window and copy and paste it into the the text dcoument.  Navigate to the file in explorer, copy the path from the explorer address box and paste below the text in the text document.  Add a "/" and copy and paste the filename.  Compare the two lines of text to find the difference and correct the file name or your code as approprate.
    Tuesday, December 8, 2009 6:59 PM
  • Use a shorter title for your topics please Filenotfoundexceptionnotfound was unhandled would have been enough .
    coding for fun Be a good forum member mark posts that contain the answers to your questions or those that are helpful
    Please format the code in your posts with the button . Makes it easier to read .
    Tuesday, December 8, 2009 9:32 PM