2 Replies - 276 Views - Last Post: 03 October 2012 - 02:19 PM Rate Topic: -----

#1 hutchy4122  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 22-October 11

Program not performing code after FileSystem.Input method

Posted 03 October 2012 - 10:54 AM

Hi guys, I'm making a program that can store user-inputted recipes and retrieve them. I am having problem with displaying the retrieved recipe. Everything works up to the point after inputting the data from a text file into variables. This seems to work, but the program has decided not to carry out any of the code following it. I even tried to display a simple message box, but even that didn't work.

Here is my code:

Private Sub EditRecipe_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load
        strFilePath = My.Application.Info.DirectoryPath & "\" & strOpenedRecipe & ".txt"
        'strOpenedRecipe is a public variable assigned a value in the previous form.
        MsgBox(strFilePath)
        'This message box says that there is no problem with the file path
        FileSystem.FileOpen(intFileIndex, strFilePath, OpenMode.Input)
        FileSystem.Input(intFileIndex, strRecipe)
        'If I put a "MsgBox(strRecipe)" in here it shows the correct value for the strRecipe variable
        FileSystem.Input(intFileIndex, intPeople)
        FileSystem.Input(intFileIndex, intIngredients)
        FileSystem.FileClose(intFileIndex)
        'But anything after this point doesn't seem to work. If I put another "MsgBox(strRecipe) in here it does not    display it

        ReDim strIngredients(intIngredients - 1)
        ReDim strQuantities(intIngredients - 1)
        ReDim strUnits(intIngredients - 1)

        lblRecipe.Text = strRecipe
        txtPeople.Text = intPeople
        lboxIngredients.Items.Clear()

        For i = 0 To UBound(strIngredients)                          'All of this code doesn't seem to be performed
            FileSystem.Input(intFileIndex, strIngredients(i))
            FileSystem.Input(intFileIndex, strQuantities(i))
            FileSystem.Input(intFileIndex, strUnits(i))
            lboxIngredients.Items.Add(strQuantities(i) & " " & strUnits(i) & " of " & strIngredients(i))
        Next

        FileSystem.FileClose(intFileIndex)
    End Sub



I have never encountered anything like this before, and I was wondering if you guys could help.

Many thanks,

Matt

Is This A Good Question/Topic? 0
  • +

Replies To: Program not performing code after FileSystem.Input method

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8371
  • View blog
  • Posts: 31,101
  • Joined: 12-June 08

Re: Program not performing code after FileSystem.Input method

Posted 03 October 2012 - 10:57 AM

Start with the basics. First wrap all of that in a try catch. Then slap a breakpoint at the top of that event and step through each line of code. Typically if code stops working it's because something bombed out in that method.
Was This Post Helpful? 1
  • +
  • -

#3 hutchy4122  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 22-October 11

Re: Program not performing code after FileSystem.Input method

Posted 03 October 2012 - 02:19 PM

Thanks so much. It told me exactly what I had done wrong. Problem solved. +1 for you :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1