[Solved] Split an existing indexed array


Here was my solution, I was calling to the array before the foreach loop did its job reading the txt file, thanks for the assistance Toby <3

string[] taxArray = new string[2];
            int count = 0;
            // string incomeBracket = taxArray[0];

            //string[] incomeBracketArray = incomeBracket.Split(',');

            try
            {
                if(File.Exists(filePath))
                {

                    //read the lines from text file add each line to its own array index.
                    foreach (string line in File.ReadLines(filePath, Encoding.UTF8))
                    {
                        taxArray[count] = line;
                        txtDisplay.Text += taxArray[count] + "\r\n";
                        count++;
                    }
                    string[] incomeBracket = taxArray[1].Split(',');
                    txtDisplay.Text = incomeBracket[0];

                else
                {
                    MessageBox.Show("This file cannot be found");
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

solved Split an existing indexed array