Results 1 to 30 of 30

Thread: [RESOLVED] Reading TxT file with TAB deliminated colums and then create array.

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Resolved [RESOLVED] Reading TxT file with TAB deliminated colums and then create array.

    I have a text file with numbers, it consists of x rows each with 6 TAB deliminated columns.
    20 44 55 12 12 29
    33 77 13 19 33 44 and so on.....

    1) I am trying to read the txt file.
    2) Create a array from the whole txt file contents.
    3) and then create and array.
    4) Display the array contents in a list box.

    Here is my attempt but its not working out.

    Thanks
    Johan

    Imports System.IO
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim fs As New StreamReader("ages.txt")

    While fs.Peek() <> -1
    Dim line As String = fs.ReadLine()
    Dim fields As String() = line.Split(New String() {"/t"}, StringSplitOptions.None)

    lstages.Items.Add(fields)

    End While

    End Sub

  2. #2
    Fanatic Member BenJones's Avatar
    Join Date
    Mar 2010
    Location
    Wales UK
    Posts
    625

    Re: Reading TxT file with TAB deliminated colums and then create array.

    You chould try first reading the whole file into an array line by line, then what you can do is go to say for example array slot 2 contents of the the record maybe 1,1,2,3,8

    what you can do is extract this into a string.
    astring = rec(2)

    now that astring contains the strings you can then use your split. to extract each field.

    I don;t use VB.NET so I am only going of what I know in C#
    Hope it may help.

  3. #3
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Reading TxT file with TAB deliminated colums and then create array.

    if you are trying to get a list of one age one each line in the listbox then
    you will need to use lstAges.Items.AddRange(fields).

    If you are trying to get a grid of ages 6 columns wide the the listbox is the wrong control for the job. You will want to use the datagridview or listview control instead.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  4. #4

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    My Main objective is to read the txt file, and create the array for further calculations.

    Thanks for the ideas so far.
    Johan

  5. #5

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi,

    I should have mentioned that I do not normally code, the last time that I needed to do something was in vb6.

    I have looked on the web and I can not find a solution.

    The file
    I have a text file with ages, it consists of x rows each with 6 TAB deliminated columns.

    20 44 55 12 12 29
    33 77 13 19 33 44
    45 66 23 55 12 22
    and so on.....

    1) I am trying to read the txt file.
    2) Create a array from the whole txt file contents.
    3) and then create and array.

    Can some-one please help me with the code ?

    Thanks
    Johan

  6. #6
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    10,317

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Assume for a second that you have a string that looks like this:
    Code:
    Dim file As String = String.Format("20{0}44{0}55{0}12{0}12{0}29{1}33{0}77{0}13{0}19{0}33{0}44{1}45{0}66{0}23{0}55{0}12{0}22", VbTab, Environment.NewLine)
    The first step would be to get each line. This is done by using String.Split at each NewLine character:
    Code:
    Dim file As String = String.Format("20{0}44{0}55{0}12{0}12{0}29{1}33{0}77{0}13{0}19{0}33{0}44{1}45{0}66{0}23{0}55{0}12{0}22", VbTab, Environment.NewLine)
    Dim lines() As String = file.Split({Environment.NewLine}, StringSplitOptions.None)
    Now that we have each row in the file it is time to create the 2 dimensional array that will represent the various cells. However, we need to specify the upper bounds of both dimensions; the first dimension will be the columns and the second dimension will be the rows. The amount of columns will be the amount of items in the first line or row where as the amount of rows will be the lines variable's length:
    Code:
    Dim file As String = String.Format("20{0}44{0}55{0}12{0}12{0}29{1}33{0}77{0}13{0}19{0}33{0}44{1}45{0}66{0}23{0}55{0}12{0}22", VbTab, Environment.NewLine)
    Dim lines() As String = file.Split({Environment.NewLine}, StringSplitOptions.None)
    Dim table(lines(0).Split(VbTab).Length - 1, lines.Length - 1) As String
    Now that we have the upper-bounds of the two dimensions, it is time to loop through each cell and set the value. This will be done by using a nested For/Next loop to iterate through each individual value:
    Code:
    Dim file As String = String.Format("20{0}44{0}55{0}12{0}12{0}29{1}33{0}77{0}13{0}19{0}33{0}44{1}45{0}66{0}23{0}55{0}12{0}22", VbTab, Environment.NewLine)
    Dim lines() As String = file.Split({Environment.NewLine}, StringSplitOptions.None)
    Dim table(lines(0).Split(VbTab).Length - 1, lines.Length - 1) As String
    
    For row As Integer = 0 To lines.Length - 1
        For column As Integer = 0 To lines(0).Split(VbTab).Length - 1
            table(column, row) = lines(row).Split(VbTab)(column)
        Next
    Next
    Voila! Now you have your 2d array. Now because you're reading this from a Text file, you're able to skip declaring file and also skip splitting at the NewLine steps by simply declaring your lines variable as:
    Code:
    Dim lines() As String = IO.File.ReadAllLines("my_path.txt")
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  7. #7
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Reading TxT file with TAB deliminated colums and then create array.

    To sum up what dday9 is saying by using intermediate variables,

    Code:
    ' Read All lines of text from the text file into an array of strings. (Lines of text)
    Dim lines() As String = IO.File.ReadAllLines("my_path.txt")
    
    ' Get the dimensions of the 2D array we will need to hold the table information.
    Dim ColumnsUpperBound as integer = lines(0).Split(VbTab).Length - 1
    Dim RowsUpperBound as integer =  Lines.Length - 1
    
    ' Define empty 2D array
    Dim table(ColumnsUpperBound, RowsUpperBound) As String
    
    ' Loop through the list of lines.
    For rowIndex As Integer = 0 To lines.Length - 1
    
      ' Break the current line into tab delimited columns  
      Dim Columns() as string = lines(rowIndex).Split(VbTab)
    
        For columnIndex As Integer = 0 To Columns.Length - 1
    
            ' Fill each cell in the table.
            table(columnIndex, rowIndex) = Columns(columnIndex)
        Next
    Next
    
    ' The 2D table now holds the grid of data.
    Last edited by Gruff; Apr 22nd, 2015 at 11:00 AM.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  8. #8

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Thank You, that really helped me.
    Just wondering, I can not seem to find an authoritve answer for what is the best way to display the 2D array. I get a error when trying to display in a "data grid view" something about not being able to display a 2D array.

    I have used a list box, and it works(code below), just one problem the output(ages) do not allign because some ages are a single digit. Will you be able to tell me if there is a better way to display the 2Array or how do I get the output to align in the columns.

    Thanks for your help.
    Johan


    The 2D table now holds the grid of data.


    Dim tempy As String = ""
    Dim row As Integer
    Dim col As Integer




    For row = 0 To RowsUpperBound

    For col = 0 To ColumnsUpperBound

    tempy = tempy & " " & table(col, row).ToString()

    Next

    ListBox1.Items.Add(tempy)
    tempy = ""

    Next

  9. #9
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Reading TxT file with TAB deliminated colums and then create array.

    The standard Listbox does not support true columns.

    You can force it to display columns by using a fixed width font. (Every character is the same width.) This tends to look really ugly though.
    Further you cannot (easily) pull data out of each cell position.

    You can fill the datagridview directly without creating a 2D array.
    Code:
    Public Class Form1
    
      Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ' Read All lines of text from the text file into an array of strings. (Lines of text)
        Dim lines() As String = IO.File.ReadAllLines("C:\my_path.txt")
    
        ' Get the dimensions of the 2D array we will need to hold the table information.
        Dim ColumnsUpperBound As Integer = lines(0).Split(CChar(vbTab)).Length - 1
        Dim RowsUpperBound As Integer = Lines.Length - 1
    
        With DataGridView1
          'Add columns
          For i As Integer = 0 To ColumnsUpperBound
            .Columns.Add("C" & i.ToString, "C" & i.ToString)
          Next
          'Add Rows
          .Rows.Add(RowsUpperBound)
    
          '------
          ' Loop through the list of lines.
          For rowIndex As Integer = 0 To lines.Length - 1
    
            ' Break the current line into tab delimited columns  
            Dim Columns() As String = lines(rowIndex).Split(CChar(vbTab))
    
            For columnIndex As Integer = 0 To Columns.Length - 1
    
              ' Fill each cell in the table.
              .Rows(rowIndex).Cells(columnIndex).Value = Columns(columnIndex)
            Next
          Next
        End With
      End Sub
    End Class
    Last edited by Gruff; Apr 27th, 2015 at 02:54 PM.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  10. #10
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    Location
    South of the Mason-Dixon Line
    Posts
    2,256

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Quote Originally Posted by debeerj@hotmail.com View Post
    ...
    Just wondering, I can not seem to find an authoritve answer for what is the best way to display the 2D array. ...
    This is because there is no authoritative answer on how to display a 2D array: it completely depends on the application.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  11. #11

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Thanks SJ,

    Looking at my attempt, how would you display the data, in a ListBox? and if so how could I align the output of the array in this ListBox

    Thanks
    Johan

  12. #12
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Did you not try the code I posted using a datagridview in post #9?
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  13. #13

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi Gruff,

    I thought that if I do not create a 2d array I will not be able to work(calculations) on the ages. I will however after I have added to the array save it to a txt file and re-read the final data into the datagrid view. The neatness I suppose is not important while the data is still being worked on.
    Thanks
    Johan

  14. #14

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    I would like to search each row to see where the very next age value is.
    There is something wrong with my logic, I can not find the mistake because now the program just hangs.

    Here is my attempt:
    1) Starting from the first value "table(0,0)" I am trying to search from the 2nd row(column 0 to 5) onwards in the table until I have found (0,0). then I save the rowindex where the find was made in the 6th field of the 1st row. I want to reapeat this for each of the remaining columns in the 1st row. So the result for table(0,5) will be saved to table(0,11).
    2) Then I start with the 2nd row, start searching from the 3rd row and saving the rowindex to the 6th field on the second row, and so on

    Thanks for looking at it.
    Johan

    Dim toetsRylyn As Integer
    Dim toetsKolom As Integer
    Dim loop1 As Integer

    For ryIndex As Integer = 0 To 370


    toetsRylyn = ryIndex + 1

    For Kolomindex As Integer = 0 To 5

    loop1 = 0
    toetsKolom = 0
    TextBox1.Text = ryIndex

    Do Until table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn))
    toetsRylyn = ryIndex + 1
    If (table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn))) = False Then
    loop1 = 0
    toetsKolom = 0
    Do Until loop1 = 6 Or (table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn)))
    If (table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn))) = False Then
    toetsKolom += 1
    loop1 += 1
    End If
    Loop
    toetsRylyn += 1
    End If
    Loop

    table(Kolomindex + 6, ryIndex) = toetsRylyn
    Next
    Last edited by debeerj@hotmail.com; May 3rd, 2015 at 02:41 AM. Reason: Provided a better description.

  15. #15

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    oops I did not increment the search rows!!

    Sorry
    Johan

  16. #16

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Nope, I thought it worked but NO! after checking the data it seems to find the value but saving the incorrect row number on some of them.
    Am I doing the loops correct?
    Thanks
    Johan

  17. #17

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi, I think I am being sucked into the fortex of vb.net and its not fun.

    I have changed the input data location and I am getting the same, IS it because the array is not a integer?

    Thanks
    Johan

  18. #18

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi,

    I have changed the code but I still get the incorrect location. Where am I going wrong?

    Dim toetsRylyn As Integer
    Dim toetsKolom As Integer
    Dim loop1 As Integer



    For ryIndex As Integer = 0 To 370


    toetsRylyn = ryIndex + 1

    For Kolomindex As Integer = 0 To 5

    loop1 = 0
    toetsKolom = 0
    toetsRylyn = ryIndex + 1


    Do While Not table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn))


    loop1 = 0
    toetsKolom = 0
    toetsRylyn = toetsRylyn + 1

    Do Until (table(Kolomindex, ryIndex).Contains(table(toetsKolom, toetsRylyn))) Or loop1 = 6

    toetsKolom += 1
    loop1 += 1


    Loop


    Loop
    table(Kolomindex + 7, ryIndex) = toetsRylyn

    Next



    Next

  19. #19

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    hello,

    it must be something to do with the type of data because one age is 90 and it finds the first 9 and not 90.
    I have searched for a way to convert but it does not work.
    Dim intList = stringList.ConvertAll(Function(str) Int32.Parse(str))
    and
    Dim intList = stringList.ConvertAll(AddressOf Int32.Parse)

    Maybe you have noticed that I am not a VB.NET programmer, I battle with a excell spread sheet and thought to code in vb.net will would save me time. So please be patient with me.

    Thanks
    Johan

  20. #20
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Reading TxT file with TAB deliminated colums and then create array.

    I haven't got the time to completely understand what you are trying to achieve, but here is an example of totaling each cell in each row to the last cell.

    Hopefully that will give you a leg up.

    The datagridview is 0 based for both rows and columns.
    so the last cell in each row is row.cells.count - 1.
    Code:
      Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        For Each Row As DataGridViewRow In DataGridView1.Rows
          Dim Total As Integer = 0
          'add all cells in the row together except the last.
          For x As Integer = 0 To Row.Cells.Count - 1
            'Convert cell text to integer and add to total.
            Total += CInt(Row.Cells(x).Value)
          Next
          'Place the total in the last cell in the row.
          Row.Cells(Row.Cells.Count - 1).Value = Total
        Next
      End Sub
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  21. #21

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Thanks Gruff,

    I have solved the integer problem by reading the string array into a integer array, and by changing the "Contains" to a "equal".

    I am trying to find on each row the first match and then save the row index of the matched value,,,,, but the ussue is that the only correct reported values are the first row.

    When you do have a moment please can you check my logic.


    Thasnks
    Johan

    Dim toetsRylyn As Integer
    Dim toetsKolom As Integer
    Dim loop1 As Integer

    For ryIndex As Integer = 0 To 370


    toetsRylyn = ryIndex + 1

    For Kolomindex As Integer = 0 To 5

    'loop1 = 0''''
    'toetsKolom = 0''''
    'toetsRylyn = ryIndex + 1''''


    Do Until table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn))



    toetsRylyn = ryIndex + 1
    Do Until (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn)))
    loop1 = 0
    toetsKolom = 0


    Do Until (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn))) Or loop1 = 6

    toetsKolom += 1
    loop1 += 1


    Loop

    If loop1 = 6 Then
    toetsRylyn = toetsRylyn + 1
    End If
    Loop

    Loop
    table1(Kolomindex + 7, ryIndex) = toetsRylyn

    Next


    Next

  22. #22

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    the first row of the integer array looks like this

    90 44 32 12 12 29 0 44 55 1 12 29 13
    88 79 32 14 77 33 0 Problem is here

    1) the first 6 numbers are the numbers from the text file
    2) the 0 is for later
    3) the last 6 numbers are the row index of the same array where the 1st 6 numbers were found.

    The issue is that when the 2nd row of numbers are searched for the incorrect rowindex number is saved. it seems that it is out with 2. so instead of saving a row index of 20 it is saving 22.

    I have ripped this apart but I can not figure out where I am incrementing incorrectly from the second row.

    Any Ideas.

    Tanks
    Johan

    latest try below

    Dim toetsRylyn As Integer
    Dim toetsKolom As Integer
    Dim loop1 As Integer
    Dim toetsRylyn1 As Integer
    toetsRylyn = 0
    For ryIndex As Integer = 0 To 370

    toetsRylyn += 1

    For Kolomindex As Integer = 0 To 5

    toetsRylyn1 = toetsRylyn

    Do Until (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn1)))

    toetsKolom += 1
    loop1 += 1

    If loop1 = 6 Then
    toetsRylyn1 += 1
    loop1 = 0
    toetsKolom = 0
    End If

    ' If (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn1))) And Kolomindex < 6 Then
    'table1(Kolomindex + 7, ryIndex) = toetsRylyn1
    ' End If

    Loop
    table1(Kolomindex + 7, ryIndex) = toetsRylyn1

    Next

    Next

  23. #23

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Firstly I have to say that I have really gave it my all researching how to do this, and I was very impressed to see that Gruff also posted on other forums. I am not sure where on earth you get the time to help others in such a way. its humbling actually. all I can say is thank you for your time.
    Johan

  24. #24

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    I have solved my issue by creating a counter, it might not look pretty but I have checked and checked and the output is 100%.

    If some-one do have time to show me how to make the code look pretty, please do.

    Thanks
    Johan
    code below: Its nasty but it works!
    Dim toetsRylyn As Integer
    Dim toetsKolom As Integer
    Dim loop1 As Integer
    Dim countersink As Integer
    countersink = 1


    For ryIndex As Integer = 0 To 8345


    toetsRylyn = ryIndex + 1

    For Kolomindex As Integer = 0 To 5

    toetsRylyn = ryIndex + 1

    Do Until (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn)))
    loop1 = 0
    toetsKolom = 0


    Do Until (table1(Kolomindex, ryIndex).Equals(table1(toetsKolom, toetsRylyn))) Or loop1 = 6

    toetsKolom += 1
    loop1 += 1


    Loop

    If loop1 = 6 Then
    toetsRylyn = toetsRylyn + 1
    countersink += 1
    End If
    Loop


    table1(Kolomindex + 7, ryIndex) = countersink
    countersink = 1
    Next

    Next

  25. #25

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    now for my very last question on this, How do I save my 8000 row 12 column Integer array? so it looks like the TAB deliminated text file that I was reading it from?

    this would be very usefull to inport it back into excel...

    I tried the following but the out put text file is full of Rubbish.

    Using writer As New StreamWriter(File.OpenWrite("c:\data1.txt"))
    For x As Integer = 0 To table1.GetUpperBound(0)
    For y As Integer = 0 To table1.GetUpperBound(1)
    writer.WriteLine(table1(x, y))
    Next
    Next

    End Using

    Thanks again for all the help
    Johan

  26. #26

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hello,

    Is there a simple straight forward why to save the 2D with "tab" delimited to a text file?

    I have tried various ways now and the output in the text file is not what I expected.

    Thanks
    Johan

  27. #27

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi, Or maybe just a link to a good example which will explain the options.

    Thanks
    Johan

  28. #28
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,335

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi Johan,

    You've gone off topic, and this thread has a lot of posts, which means it's less likely to be attracting new viewers, and that limits the amount of help you'll be getting.


    For saving your data, see if the following makes any sense:
    Code:
    Using writer As New StreamWriter("c:\data1.txt")
    
        '   assuming table1(Columns,Rows)
        For ryIndex As Integer = 0 To table1.GetUpperBound(1)
            For Kolomindex As Integer = 0 To table1.GetUpperBound(0)
                writer.Write(table1(Kolomindex, ryIndex))
                '   only want Tab characters between fields,
                '   and not at the end of the line
                If Kolomindex <> table1.GetUpperBound(0) Then
                    writer.Write(vbTab)
                End If
            Next
            writer.WriteLine()
        Next
    
    End Using


    As to your code in Post#24: are you sure that it works properly? Surely as the row you are updating approaches the end of the array, there are less following rows to check for matches. Doesn't that mean there are less chances of finding a match? I can't see where your code makes allowance for not finding a match. I'd expect an error to be thrown in such a case.

  29. #29

    Thread Starter
    Member
    Join Date
    Apr 2015
    Posts
    52

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Hi Inferrd,

    Thanks, I have used the above code and it works like a charm. Imported it into excel.

    Post #24. I realized that there might not be age groups with similar academic achievements and it did throw up an error, but I could see at which row and it is towards the end and also closer to where we are in time, so for now I can do them manually, stupid I know, but considering that I have never used vb.net, or know how to do this.

    I am amazed at the help some guys provide here. Makes me feel ashamed that I cannot contribute as well. But I hope that I have proved that I am willing to try everything before I ask for help.

    I am sorry for going off topic and in the future I will create a new post if I cannot find help in existing posts.

    How do we close this post to "resolved"?

    Thanks again
    Johan
    Last edited by debeerj@hotmail.com; May 8th, 2015 at 06:19 AM. Reason: corrected spelling mistakes

  30. #30
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,335

    Re: Reading TxT file with TAB deliminated colums and then create array.

    Sounds like you are on top of things, but if you get stuck, don't hesitate to post back. Just keep in mind the general advice of only one thread per topic, and only one topic per thread.

    To set the thread as resolved, just above the first post and to the right there is a drop down named "Thread Tools". What you are looking for is in there.

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