Select Case mistake
#10
Thank you for the hints. But unfortunately none of that works.
It's about Select Case and Select EveryCase. I wrote a small program about buying a used car to illustrate this. The program shall fall on Case Else if the purchase price is greater than 7000.00.

If greater than 5500.00, then "VW Polo . . ." are displayed, but also if it ist greater 7000.00. Yes, maybe Select Case really doesn't work so and you have to come up with something else.

Code: (Select All)
'Beispiel fuer Select Case und EveryCase - 7. Nov. 2022

Option _Explicit

Dim As Double kaufpreis

Print "Gebrauchtwagenkauf"
Print
Input "Wieviel moechten Sie ausgeben? ", kaufpreis

Print "Select Case:"
Select Case kaufpreis
  Case 4000 To 5000
    Print "Trabant, blau, frisiert - 31 KW."
  Case 5000 To 6000
    Print "Wartburg, dunkelgruen, 74.00 KM, 40 KW."
  Case Is > 5500
    Print "VW Polo, beige, 110.000 KM, 44 KW"
  Case Else
    Print "Haben wir leider nicht im Angebot!"
End Select

Print
Print "Select EveryCase:"
Select EveryCase kaufpreis
  Case 4000 To 5000
    Print "Trabant, blau, frisiert - 31 KW."
  Case 5000 To 6000
    Print "Wartburg, dunkelgruen, 74.00 KM, 40 KW."
  Case Is > 5500
    Print "VW Polo, beige, 110.000 KM, 44 KW"
  Case Else
    Print "Haben wir leider nicht im Angebot!"
End Select

End

Until this case it works:

[Image: Case-BSP2022-11-07-214855.jpg]
Reply


Messages In This Thread
Select Case mistake - by Kernelpanic - 11-07-2022, 09:09 PM
RE: Select Case mistake - by mnrvovrfc - 11-07-2022, 09:19 PM
RE: Select Case mistake - by SMcNeill - 11-07-2022, 09:35 PM
RE: Select Case mistake - by SMcNeill - 11-07-2022, 09:29 PM
RE: Select Case mistake - by Pete - 11-07-2022, 09:41 PM
RE: Select Case mistake - by SMcNeill - 11-07-2022, 09:45 PM
RE: Select Case mistake - by Pete - 11-07-2022, 09:52 PM
RE: Select Case mistake - by mnrvovrfc - 11-07-2022, 10:14 PM
RE: Select Case mistake - by Pete - 11-07-2022, 10:20 PM
RE: Select Case mistake - by mnrvovrfc - 11-07-2022, 10:27 PM
RE: Select Case mistake - by Kernelpanic - 11-07-2022, 10:21 PM
RE: Select Case mistake - by Kernelpanic - 11-07-2022, 10:36 PM
RE: Select Case mistake - by Kernelpanic - 11-08-2022, 02:57 PM
RE: Select Case mistake - by Pete - 11-08-2022, 03:28 PM
RE: Select Case mistake - by SMcNeill - 11-08-2022, 03:58 PM
RE: Select Case mistake - by Pete - 11-08-2022, 04:17 PM
RE: Select Case mistake - by Kernelpanic - 11-08-2022, 04:21 PM
RE: Select Case mistake - by Pete - 11-08-2022, 04:28 PM
RE: Select Case mistake - by Kernelpanic - 11-08-2022, 04:28 PM



Users browsing this thread: 11 Guest(s)