I am relativaly new to Visual C#. 
I am creating a program where there are a list of pictureboxes. I have a for loop, that plays a .wav file according to the image in the pictureboxes. I am using the PlaySync method, so that for every i in the loop, a .wav file is played (corresponding to a different picturebox) until the end, and then the i increases and then a different note is played.
For every note (basically every i of the loop) i want to change the background color of the picturebox that the .wav file is being played.
The code runs without coloring the pictureboxes, unless I add a messagebox in the loop.  I am pretty sure that I need an inerrupter in the loop in order to give the program a chance to color the pictureboxes.  I have tried using delay (Thread.Sleep()) in order to break the program, but it doesn't work.
Do I need to interupt the loop? If yes, what will work?
This is my code: 
*arrindex is an integer that represents the number of notes to play
*pboxlist = the list of pictureboxes
*tempind = the index of the list of pictureboxes
    for (int i = 0; i <= arrindex; i++)
            {               
                if (tempind < pboxlist.Count()) //coloring the pictureboxes
                {
                    if (tempind != -1)
                    {
                        pboxlist[tempind].BackColor = Color.Transparent; //coloring the previous picturebox back to transparent
                    }
                    tempind++;
                    pboxlist[tempind].BackColor = Color.LightPink;
                }
                    regwav[row, col].PlaySync(); // a matrix where the .wav files are stored (row and col are integers that determine which .wav file to play)
        }