Next Button

Aug 29 2011 1:15 PM
Hey Guys! I want to execute below code using 'NEXT' button , 
  for (int j = 1; j < myArray.Length; j++)
       {     
               int key = myArray[j];
                int i = j - 1;


                while (i >= 0 && myArray[i] > key)
                {
                    int temp = key;
                    myArray[i + 1] = myArray[i];
                    myArray[i] = temp;
                    i = i - 1;


                }
}


Like this:http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html     I want to run this code's each line when my "NEXT" button push. I mean 1st code line run when 1st time push button clicked, and 2nd line run after 2nd time clicked 'NEXT' button! 
I really would appreciate some help or at least a point in the right direction.  I generally search in google, but have been doing so for hours with no luck.  Hopefully someone here can help?



Answers (4)