This error is due to the source code:
string[] search = Directory.GetFiles(@folderBrowserDialog1.SelectedPath, "*.*");
And the problem with this line is that you create a new array 'search' but you don't define a size. When you create an array you have to either define a size for the array, or declare its elements.
Hope, it clarifies.