FOR/NEXT loop with variables/ solved!
Posted: Tuesday 15th March 2022 5:16pm
Dear Friends,
as my logic synapses aparently having gone on holidays, I'm stuck with 2 issues.
First:
With a For/Next loop like
For i = ListBox1.count - 1 DownTo ListBox1.count - 180
I want with ValueBoxes labeled START and END to have the user define the ListBox.Count Start-and End-Numbers. I tried to replace -1 and -180 with Integer variables - like:
For i = ListBox1.count - START DownTo ListBox1.count - END
or - leave the loop alone, if the ValueBoxes are "" or empty ...
I got nowhere ... String-Variables also not accepted.
********************************************************
Second:
While the For/Next loop is running through the items of Listbox1 (a list - about 200 items - of Numbers from 0 to 36), it produces "loss" or "win" and a "balance" all of thouse listed in further ListBoxes regarding to thier variables:
loss
totloss
win
totalwin
balance
Works pretty well and matches manual test/control on a spread sheet.
Now I want to catch the trends - as it does not make sense to further bet on a down trend unless a upward trend appears again.
I got around it by limiting betting to 6 or 9 loops/coups. It would be smart, if bets only start after 3 consecutive wins or are not further done after 3 consecutive (excuse spelling) losses.
******************************************************
I'm attaching a screenshot but also could add the code for further understanding (if you prefer some entertainment with my humptydumpty coding).
Would appreciate some hints. Your hints with a previous issue where excellent ...
Well and Third:
How do I leave a FOR/NEXT loop if a condition is reached whithout closing the application? Stop und Exit ? or just Form1.Show? ....
Klaus
as my logic synapses aparently having gone on holidays, I'm stuck with 2 issues.
First:
With a For/Next loop like
For i = ListBox1.count - 1 DownTo ListBox1.count - 180
I want with ValueBoxes labeled START and END to have the user define the ListBox.Count Start-and End-Numbers. I tried to replace -1 and -180 with Integer variables - like:
For i = ListBox1.count - START DownTo ListBox1.count - END
or - leave the loop alone, if the ValueBoxes are "" or empty ...
I got nowhere ... String-Variables also not accepted.
********************************************************
Second:
While the For/Next loop is running through the items of Listbox1 (a list - about 200 items - of Numbers from 0 to 36), it produces "loss" or "win" and a "balance" all of thouse listed in further ListBoxes regarding to thier variables:
loss
totloss
win
totalwin
balance
Works pretty well and matches manual test/control on a spread sheet.
Now I want to catch the trends - as it does not make sense to further bet on a down trend unless a upward trend appears again.
I got around it by limiting betting to 6 or 9 loops/coups. It would be smart, if bets only start after 3 consecutive wins or are not further done after 3 consecutive (excuse spelling) losses.
******************************************************
I'm attaching a screenshot but also could add the code for further understanding (if you prefer some entertainment with my humptydumpty coding).
Would appreciate some hints. Your hints with a previous issue where excellent ...
Well and Third:
How do I leave a FOR/NEXT loop if a condition is reached whithout closing the application? Stop und Exit ? or just Form1.Show? ....
Klaus