|
-
Nov 12th, 2000, 05:15 AM
#1
Thread Starter
Fanatic Member
This is wat I have in code
Select case counter
case 1
shape1.backcolor = shape75.backcolor
shape2.backcolor = shape76.backcolor
shape3.backcolor = shape77.backcolor
shape4.backcolor = shape78.backcolor
shape5.backcolor = shape79.backcolor
shape6.backcolor = shape80.backcolor
case 2
shape7.backcolor = shape75.backcolor
shape8.backcolor = shape76.backcolor
shape9.backcolor = shape77.backcolor
shape10.backcolor = shape78.backcolor
shape11.backcolor = shape79.backcolor
shape12.backcolor = shape80.backcolor
case 3
shape13.backcolor = shape75.backcolor
shape14.backcolor = shape76.backcolor
shape15.backcolor = shape77.backcolor
shape16.backcolor = shape78.backcolor
shape17.backcolor = shape79.backcolor
shape18.backcolor = shape80.backcolor
And so on until case 50!
end select
Is there a shorter way to do this?
I want to change the numeric value an do create
a for next loop.
I've tried a few things but can't get it right.
thanks for your time.
Ray
-
Nov 12th, 2000, 05:36 AM
#2
Hyperactive Member
maybe you can manipulate this
Code:
For Each c In Me.Controls
If TypeOf c Is TextBox Then
c.BackColor = frm_Main.SkinForm1.SkinSource.ClrWindow
c.ForeColor = frm_Main.SkinForm1.SkinSource.ClrWindowText
End If
Next
[]P
Visual Basic 6 SP4 on win98se
QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!
-
Nov 13th, 2000, 03:06 AM
#3
Thread Starter
Fanatic Member
[QUOTE]Originally posted by marex
To Private1
That's the code I used, after a littele modification, to
change all the shapes color in white.
You've send it to me a few days ago.
That is working fine.
But as you see, after every pass I have to change
different shapes.
After the 1st pass it's only shape1 until shape6 that changed.
after the 2nd pass it's only shape7 until shape12
and so on for 50 passings.
Pass 50 is shape295 until shape300.
Wat I like to do is change only the numeric value in the
object name in another numeric value depending on the
pass. So I keep the name shape + value x.
So Shape1 changed into Shape7,
Shape2 changed into Shape8.
I'm not sure if it is possibble to rename a piece of the objects name.
If there is a solution than I have only to write 1
piece of code with the first 6 shapes and a little loop
with a counter to change the value in value + 6.
To simplifie the question, how can I do this
for C = sCycle to eCycle
shape&C.backcolor = shape99.backcolor
next
Who knows?
Cheers
Ray
[Edited by marex on 11-13-2000 at 06:31 AM]
-
Nov 13th, 2000, 08:56 AM
#4
Fanatic Member
With that many controls, I'd try a control array, easy to for next loop through. Each shape has an index property. Just set that to the number of the shape (IE: Shape1 = Shape(1), Shape80 = Shape(80), etc. ...). This should make things a bit easier for you. If you think it warrants it, setting up two shapes (Shape1(), and Shape2(), or any other meaningful names) and make the indexes equal. Then when you do a for next loop:
Code:
For X = 0 To 50
Shape1(X).BackColor = Shape2(X).BackColor
Next X
Just an idea.
-
Nov 13th, 2000, 10:28 AM
#5
Thread Starter
Fanatic Member
To ExcalibursZone
Great!! 
It's exactly what I wanted.
Could'nt be better.
Thanks for your tip
Ray
[Edited by marex on 11-13-2000 at 11:34 AM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|