I have a popup menu with 100 rows of data and I would like after a press of a button to get a random row index value being selected. Is this possible?
There are a number of ways of doing this depending upon where your data is from.
There is a build in random number generator. If you look at System.Random. It would allow you to generate a sequence of random numbers, one for each row.
You could add a column to the table, fill it with a the random number, sort by it and then remove the column.
If you have your data in an SQL database and load it from there you could use the random function of the database in a select statement that would order your source data and then reload it.
If your data in held in a series of arrays you could generate an additional array using the random numbers sort that array together with your arrays and then reload into the listbox.
Yep, this is a one-liner.
myPopupMenu.SelectedRowIndex = System.Random.InRange(0,99)
Look up random in the documentation.
I misread the issue, I thought you wanted it sorted!
Thanks so much, I got it to work:
ComboActionSubject.SelectedRowIndex = System.Random.InRange(0,29) ComboActionConflict.SelectedRowIndex = System.Random.InRange(0,21) ComboActionResolution.SelectedRowIndex = System.Random.InRange(0,26)