I'm not really sure the best way to go about doing this, so I've come to the forum hoping to get some help. Basically, my program has 5 threads and each thread works with the data that's inside its associated RichTextBox (Thread1 goes off the lines in RichTextBox1...Thread2 goes off the lines in RichTextBox2..etc).

What I would like to do is load a text file and have the program split that text file up into each RichTextBox in a specific way. If the file has 10 lines of data and the program is running 5 threads then I want line #1 and line #6 put into RichTextBox1, then line #2 and line #7 into RichTextBox2, line #3 and line #8 into RichTextBox3...etc. However, the file might not always have 10 lines of data and I might not always run all 5 threads. At times it might have 7 lines of data and 5 threads selected, or 8 lines of data and 3 threads selected. Basically, the number of lines in the text file will always be different and the number of threads I'm wanting to run can be different as well.

I figure that in order to do this I need to look at how many lines are in the text file and how many threads are selected to run (1-5). I can divide those two numbers to determine how many lines will go into each RichTextBox, but if it isn't a whole number then that's going to mess things up..

As you can see from my code below, I'm able to read in the text file and put the lines into an array so I can remove any blank/empty lines. I'm also able to divide these numbers to determine how many will go into each box, but now I'm stuck. I thought putting these items into an array would make them easier to work with, but to be honest I'm also not sure if that's the best way to go about handling this. Any help or guidance would be appreciated!

Code:
    Private Sub btnLoad_Click(sender As Object, e As EventArgs) Handles btnLoad.Click
        OpenFileDialog1.Title = "Please Select a File"
        OpenFileDialog1.Filter = ("text files (*.txt) | *.txt")
        OpenFileDialog1.FileName = vbNullString           'Clear out previous filename
        startpath = My.Settings.loadPath
        OpenFileDialog1.InitialDirectory = startpath
        If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            selectedfile = OpenFileDialog1.FileName

            'Store the file path
            Dim sPath As String
            sPath = OpenFileDialog1.FileName 'get the path
            sPath = StrReverse(sPath) 'reverse the string
            sPath = Mid(sPath, InStr(sPath, "\"), Len(sPath)) 'extract from the first slash
            sPath = StrReverse(sPath) 'reverse it again
            My.Settings.loadPath = sPath

            'readinfile()
            Dim quoteArray As String() = File.ReadAllLines(selectedfile)

            Dim lst = quoteArray.ToList()
            Dim nullOrEmptyItemCount = lst.RemoveAll(Function(s) String.IsNullOrEmpty(s))

            Dim itemsPerBox As Integer
            itemsPerBox = lst.Count / nmThreads.Value

        Else
            Exit Sub
        End If
    End Sub