@Ex-jobb wrote:
... the problem is that we want to jump over the first run, when the size of the "sampelnr" still is zero because we initiate the array the first time and then it is empty.
Here we are talking about the big case structure. A better solution would be to skip the code whenever the array size is zero, even if it is not the first run. Here the solution of tst seems reasonable and it should work.
You don't need a case "1", because the default case also handles arrays with size 1 correctly.
@Ex-jobb wrote:
And there is one moore thing. When the dialogboxes shows and one click any button we want to quit or just continue the program...
Clearly, many things are missing from the program, because the array never grows so it would no make sense to loop at all because the data does not change. In any case it needs to run only once and it should not depend on which button is pressed.
IF you want to stop or continue the loop depending on which button is pressed in the dialog box, just tap into the dialog box output and use it for the loop condition.
Attached shows a possibility.