How to create a "Type" to set properties?

skyfox
02-17-2008, 05:47 AM
Hello all,

is it possible to set "MULTIPLE" property attributes of a control using some sort of trickery? Voodoo? or Magic?

Perhaps a clever coding trick that I am unaware of.


for an example......

Select case something

Case 0
Do something different here

with label1
.visible = true
.backcolor = VbRed
.Caption = "STOPPED"
end with

case 1
And now for something copletely different here, as well as rest of the select case statements.

' but label properties are the same for case 0 to 100
case ............

case 101
Do something different here 'But with different set of label properties for nxt 100 select case statements

with label1
.visible = true
.backcolor = VbGreen
.Caption = "Running"
end with

So instead of repeating the "SAME" label properties 100 times for each of the first 100 Select Case statements, is their a better way to do this besides calling another sub repetedly just to set the label properties?

Thanks!

Flyguy
02-17-2008, 06:06 AM
If you don't want to create a sub with 3 parameters then you indeed need to use voodoo. :-\

the master
02-17-2008, 06:22 AM
If i understand you correctly then you can use "to"


select case something
case 0 to 100

'First set of properties

case 101

'Second set

end select


If you want to do something else differently then you would simply put another select case statement after this one to control the other things you want changing

skyfox
02-17-2008, 06:43 AM
Thanks Flyguy & Master,

Yes you understood me. And I see what you meant by the second set of select case statments in the same sub. This would do the trick.

Thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum