I have a question using a button array. I wanted to access a corresponding pic box while im looping through my button array...Is there a way to store the index to a variable to pass into the next method?
Set up the method with a parameter:
As you can see, you can then access the variable within the method. To use the method:Code:private void MyMethod(int index) { MessageBox.Show("The index is " + index.ToString()); }
- this uses the index 6 to pass to the method.Code:MyMethod(6);
or you can associate "commandtext" property with the index
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks