Can you nest Select Case statements? 
Author Message
 Can you nest Select Case statements?

I have several conditions generated randomly (1 through 8).  Each condition
refers to a block of Select Case code.  Simply put, I need to evaluate the
random number and then go to the appropriate block of Select Cases.  Can you
nest this code kind of like:

Case 1
condition = 1
    Case 1
    code
    Case 2
    code
    Case n
    code
Case 2
codition = 2
    Case 1
    code
    Case n

...and so on?

Is there a better way to accomplish this?

Thanks for your suggestions.

Mark



Sun, 03 Feb 2002 03:00:00 GMT  
 Can you nest Select Case statements?
Could you provide more detail?

You can do this:

select case X
case 1
   select case y
   case 1
   case 2
   end select
case 2
   select case y
   case 1
   case 2
   end select
end select

but I don't think that's what you're trying to do?

Quote:

> I have several conditions generated randomly (1 through 8).  Each condition
> refers to a block of Select Case code.  Simply put, I need to evaluate the
> random number and then go to the appropriate block of Select Cases.  Can you
> nest this code kind of like:

> Case 1
> condition = 1
>     Case 1
>     code
>     Case 2
>     code
>     Case n
>     code
> Case 2
> codition = 2
>     Case 1
>     code
>     Case n

> ...and so on?

> Is there a better way to accomplish this?

> Thanks for your suggestions.

> Mark



Sun, 03 Feb 2002 03:00:00 GMT  
 Can you nest Select Case statements?
Yes you can do it that way, you can struture your code with some
sunction calls but it will work

Quote:

> I have several conditions generated randomly (1 through 8).  Each condition
> refers to a block of Select Case code.  Simply put, I need to evaluate the
> random number and then go to the appropriate block of Select Cases.  Can you
> nest this code kind of like:

> Case 1
> condition = 1
>     Case 1
>     code
>     Case 2
>     code
>     Case n
>     code
> Case 2
> codition = 2
>     Case 1
>     code
>     Case n

> ...and so on?

> Is there a better way to accomplish this?

> Thanks for your suggestions.

> Mark

--
Humberto Gonzalez

My personal page: http://www.geocities.com/SiliconValley/Park/5117
Business Page: http://www.interven.net/acron


Sun, 03 Feb 2002 03:00:00 GMT  
 Can you nest Select Case statements?
Perhaps the following....????

Select Case condition
    Case 1
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 2
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 3
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 4
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 5
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 6
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 7
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
    Case 8
        Select Case otherCriteria
            Case 1
            Case 2
            Case Else
        End Select 'otherCriteria
End Select 'condition

Ralf

Quote:

>I have several conditions generated randomly (1 through 8).  Each condition
>refers to a block of Select Case code.  Simply put, I need to evaluate the
>random number and then go to the appropriate block of Select Cases.  Can you
>nest this code kind of like:

>Case 1
>condition = 1
>    Case 1
>    code
>    Case 2
>    code
>    Case n
>    code
>Case 2
>codition = 2
>    Case 1
>    code
>    Case n

>...and so on?

>Is there a better way to accomplish this?

>Thanks for your suggestions.

>Mark



Mon, 04 Feb 2002 03:00:00 GMT  
 Can you nest Select Case statements?
OK, Mark
Why not just try it ???  Sad,  no experimentalists in our midst?
Are you just being lazy or scared.  No room for either in programming.
Neila

Quote:

>I have several conditions generated randomly (1 through 8).  Each condition
>refers to a block of Select Case code.  Simply put, I need to evaluate the
>random number and then go to the appropriate block of Select Cases.  Can
you
>nest this code kind of like:

>Case 1
>condition = 1
>    Case 1
>    code
>    Case 2
>    code
>    Case n
>    code
>Case 2
>codition = 2
>    Case 1
>    code
>    Case n

>...and so on?

>Is there a better way to accomplish this?

>Thanks for your suggestions.

>Mark



Mon, 04 Feb 2002 03:00:00 GMT  
 Can you nest Select Case statements?
OK, Mark
Why not just try it ???  Sad,  no experimentalists in our midst?
Are you just being lazy or scared.  No room for either in programming.
Neila

Quote:

>I have several conditions generated randomly (1 through 8).  Each condition
>refers to a block of Select Case code.  Simply put, I need to evaluate the
>random number and then go to the appropriate block of Select Cases.  Can
you
>nest this code kind of like:

>Case 1
>condition = 1
>    Case 1
>    code
>    Case 2
>    code
>    Case n
>    code
>Case 2
>codition = 2
>    Case 1
>    code
>    Case n

>...and so on?

>Is there a better way to accomplish this?

>Thanks for your suggestions.

>Mark



Mon, 04 Feb 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Embedded or nested Select Case statements

2. VBScript Select Case vs VB Select Case

3. ExitSelect & Nested Select Statements

4. Select Case Statement Help

5. Select Case Statement

6. Criteria for select case statements

7. Using a wildcard string comparison in a select case statement

8. Select Case statement is driving me mad!

9. If...Then...Else or Select Case Statement

10. Select Case Statement

11. If statement in select case problem

12. Select Case Statement

 

 
Powered by phpBB® Forum Software