Question Kind of met a brick wall with my arrays and reading from a file.

Ima20-

New member
Joined
May 23, 2012
Messages
1
Programming Experience
Beginner
I am doing an assignment which is to build a Windows Form in VS2010 which will take input from .Text fields and then process it into a text file, with the information stored line by line, with each value from the textbox stored one just one line. I've got that bit done no problems, but I'm having problems with retrieving the content from a file. I've tried a few ways and where I'm at now is creating a string array and then reading every line from the selected file into one field of the array.

The full code is here -
[VB.NET] 'The below command imports the StreamWriter and StreamReader classes required fo - Pastebin.com

The procedure I'm stuck with is here -
[VB.NET] Private Sub btnListDetails_Click(sender As System.Object, e As System.EventA - Pastebin.com

The procedure starts of by verifying if the program has run a previous procedure before by checking if the class-level variable fileSaveDialog has been used, and then prompts the user to use that file or another, it then copies the entire text of the file into an array which, and then requests a title to look up. It will then go through each element of the array until it finds that title and copies from the array, and then the subsequent elements of the array into the textbox.

Please forgive the mess of code, it's mostly due to this being the first time I've came across a lot of this and it's been learn as I go.

The problems I'm facing with this code are:

If I search for a title which isn't in the chosen text file - absolutely nothing will happen, it will just go back to the windows form.

If I search for a title which is in the chosen text file - it will just hang and nothing will happen/stop responding until it decides to stop the program.

Thanks in advance.
 
Last edited:
Back
Top