EWUScanner.ExclusionPaths.DoneWithAddingPaths_Click C# (CSharp) Method

DoneWithAddingPaths_Click() private method

private DoneWithAddingPaths_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void DoneWithAddingPaths_Click(object sender, EventArgs e)
        {
            //I decided to use a list because of it's dynamic growth capabilities
            List<string> temp = new List<string>();

            //store the paths into the string[]
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {//rows that were added to the viewer automatically, without any input, will have null as the value
                try
                {
                    temp.Add(dataGridView1.Rows[i].Cells[0].Value.ToString()); //store the paths in the string list
                }
                catch (NullReferenceException)
                {//Since i'm using a list, the null data will not be added to the list. And unlike a string[], I don't have to worry about the size of the list and possibly having unitialized array spots. A list avoids possible null-pointer values.
                    continue;
                }
            }

            mainForm.exclusionPaths = temp; //passing the data to the MainForm via internal string[]..Interesting how it works.

            this.Close(); //close the form.
        }