[RESOLVED]How to make in this loop - please help me
I'm not the best in explaining things. O.K. I will try
So, when I click the commandbutton COUNT, it my application it does one operation of calculation. Visible the progress bar on a screen shots it is registering progress executed calculations. Visible number shows how much operation was executed.
If I will click the commanbutton UNDO COUNT then will be withdrawal 1 operation, then recently segment should stopping shine.
And now, essence of matter
I make such code and I used statement Case, where I used variable as counter.
For button COUNT
VB Code:
Dim Lic As Integer
Select Case Lic
Case 0
With lbl1
.caption = 1
.Backcolor = RGB ( 44, 164, 214)
.Forecolor = RGB (255, 255, 255)
End With
Lic = 1
Case 1
With lbl2
.caption = 2
.Backcolor = RGB ( 44, 164, 214)
.Forecolor = RGB (255, 255, 255)
End With
Lic = 2
…….etc until to lbl10.caption
(Truth, that this looks fatally)
Of course, for button UNDO COUNT the statement makes in reverse order
I want this to make from use in some loop ( better For...Next) and the array of objects (Label)
Just, I don't know how to make this.
P.S. Array of objects this is simply, I know how to make.
thx, in advance for every help
Last edited by Tamgovb; Mar 10th, 2006 at 05:59 AM.
Ooopss...you have right. I correct example- code, you see
Lic it is name my variable, which is my counters. Value of this variable decides about writes to next Label. It value on start = 0. When I click the button COUNT it write to first lbl1 number 1, it will change backcolor and forecolor and value variables to 1....etc.
And next, if variable = 1, then.....etc,etc. It works fine now, but it is primitive. I want more professionally.
Last edited by Tamgovb; Feb 18th, 2006 at 09:28 AM.
Okay, but dont you see in your code if you put 'Dim Lic as Integer' you are creating a new variable, and unless you assign some data to it, since it is an integer, its default value will be 0, so it will always go down the case 0 path.
Do you have your command buttons as arrays, or do you have Lic declared elsewhere in your project?
want this to make from use in some loop ( better For...Next) and the array of objects (Label)
Just, I don't know how to make this.
P.S. Array of objects this is simply, I know how to make.
i dont know if this is what you are trying to do.
For i = Lb1.LBound To Lbll1.uBound
If Lbl1(i).Index = lic Then
With lbl1(i)
.caption = 1
.Backcolor = RGB ( 44, 164, 214)
.Forecolor = RGB (255, 255, 255)
End With
Lic = 1+i
End If
Next
Last edited by mikee_phil; Feb 18th, 2006 at 10:00 AM.
Thank you for your solution and for quick reply. But the problem is such, in order to after every turn of loop highlight ONLY 1 label. Now the all labels are highlighted in one loop turn, understand me? This is large difference.
I need such cycle: 1 turn of loop and 1 Label (in example lbl1(0)) it is highlight and it was executed 1 calculation, 2 turn of loop and 2 label (in example lbl1(1)) is highlight it was executed 2 calculation etc...
This has to be the bar progress of calculations, it has to inform user about this how much he made the calculations - this is the programme to calculation of roofs
Last edited by Tamgovb; Feb 18th, 2006 at 11:27 AM.
Thank you for your solution and for quick reply. But the problem is such, in order to after every turn of loop highlight ONLY 1 label. Now the all labels are highlighted in one loop turn, understand me? This is large difference.
I need such cycle: 1 turn of loop and 1 Label (in example lbl1(0)) it is highlight and it was executed 1 calculation, 2 turn of loop and 2 label (in example lbl1(1)) is highlight it was executed 2 calculation etc...
Here is my tip and example-code. He shows about what it walks me. I can't me with him advise. Moreover appeared error. Error jumps from 2 MsgBox, I don't know what.
Here is my tip and example-code. He shows about what it walks me. I can't me with him advise. Moreover appeared error. Error jumps from 2 MsgBox, I don't know what.
You have not Label0, correct code:
VB Code:
MsgBox "The packet of calculations is full", vbInformation, "Attention"
If MsgBox("You want to remove results", vbQuestion + vbYesNo, "questions") = vbYes Then