Results 1 to 3 of 3

Thread: [RESOLVED] printing values a tab delimited array

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2014
    Posts
    23

    Resolved [RESOLVED] printing values a tab delimited array

    *EDIT*
    This program has been changed so that it uses a 2 dimensional array instead of a 1 demensional array, so now instead of the data being stored as: ValueArray(0) = test 1, it will be saved as ValueArray(0, 0) = test 1
    If you know how to write the contents of a text delimited file into a two dimensional array it would be appreciated

    I'm writing an algorithm that reads the values in a tab delimited array and stores each value in an array, before writing the contents of each array index into a rich text box.

    this is the file chr(9) is not written in the file but represents a tab spacing:
    test1 chr(9) test2 chr(9) test3 chr(9) test(4) chr(9)

    Declarations
    Dim Importedfile As IO.StreamReader
    Dim tempstring As String = My.Computer.FileSystem.ReadAllText(path + "Testfile.txt")
    Dim Valuesarray(3) As String

    Algorithm (on button click)
    tempstring = Importedfile.ReadLine()
    Valuesarray = tempstring.Split(New Char() {Chr(9)})
    RichTextBox1.Text = Valuesarray(0) + Valuesarray(1) + Valuesarray(2) + Valuesarray(3)

    Whenever i try to execute the code it says:
    "An unhandled exception of type 'System.NullReferenceException' occurred in Tab delimited files.exe

    Additional information: Object reference not set to an instance of an object."

    and the line tempstring = Importedfile.Readline() is highlighted

    thanks for helping
    Last edited by BumpaPumpa; Jun 21st, 2015 at 04:15 AM. Reason: changes in the way the program will work

Tags for this Thread

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