Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
come gia scritto in domanda ho bisogno di evitarmi un if con 10 elseif grazie ad un select case... il problema è che cercando in internet non sono riuscito a trovare come si possa confrontare un limite di 2 valori con il case...
forse un esempio chiarisce le cose:
1° es fatto con gli if(funzionante ma lungo)
Codice sorgente - presumibilmente VB.NET
If variabile > 9 And variabile <= 18 Then
' Istruzione
ElseIf variabile > 18 And variabile <= 27 Then
' Istruzione
ElseIf variabile > 27 And variabile <= 36 Then
' Istruzione
ElseIf variabile > 36 And variabile <= 45 Then
' Istruzione
ElseIf variabile > 36 And variabile <= 45 Then
' Istruzione
ElseIf variabile > 45 And variabile <= 54 Then
' Istruzione
ElseIf variabile > 54 And variabile <= 63 Then
' Istruzione
EndIf
2° es fatto con il select case ( provato ma non funziona )
Codice sorgente - presumibilmente VB.NET
SelectCase variabile
CaseIs > 9 AndIs <=18
' Istruzione
CaseIs > 18 AndIs <=27
' Istruzione
CaseIs > 27 AndIs <=36
' Istruzione
CaseIs > 36 AndIs <=45
' Istruzione
CaseIs > 45 AndIs <=54
' Istruzione
CaseIs > 54 AndIs <=63
' Istruzione
CaseIs > 63 AndIs <=72
' Istruzione
EndSelect
nel 2 caso non riesco ad usare il select case xke non posso usare l'And per paragonare la variabile con entrambi i numeri...