VB 6.0 - Quick Case Question

Associate
Joined
12 Jan 2003
Posts
697
Location
York (+Lboro +New Malden)
Is it possible to 'run' previous cases (say, cases 1-4) if conditions for case 5 are satisfied?

Basically I want to use the code in the previous cases to prevent me from having to rewrite it! (and have long code :( )

Chris
 
I'd have thought the best option for this would be something along the lines of:

[pseudo]
Select condition
Case 1
Case1Sub

Case 2
Case2Sub

Case 3
Case3Sub

Case 4
Case4Sub

Case 5
Case1Sub
Case2Sub
Case3Sub
Case4Sub
End Select

Sub Case1Sub
'Stuff in here
End Sub

Sub Case2Sub
'Stuff in here
End Sub

Sub Case3Sub
'Stuff in here
End Sub

Sub Case4Sub
'Stuff in here
End Sub
[/psuedo]

Something like that?

*edit*
All you're doing there is moving the 'long code' you talk about into dedicated Sub's and calling them. Case 5 would, as you say, just have 4 lines of code to call each previous case which in turn call their respective Sub's
 
you could use select case's and stuff, upload the project or give a better indication of where and what it's being used for and i will try to code it up for you, i have nothing better to do:P
 
J's idea should work out pretty well. If you can post up some of the code like Thom says we can give it a look over just in case there's an even better way of organising the code.
 
Back
Top Bottom