Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [VB.NET] Select Case, non mi funziona

    Ho un risultato in una textbox, in base al suo lavoro mi deve scrivere un testo in un label

    se il valore è più piccolo di 16 deve scrivere "Sottopeso grave"
    se è compreso tra 16 e 16,99 deve scrivere "Sottopeso normale"
    se è compreso tra 17 e 18,49 deve scrivere "Sottopeso lieve"
    se è compreso tra 15,50 e 24,99 deve scrivere "Normopeso"
    se è compreso tra 25 e 29,99 deve scrivere "Sovrappeso"
    se è compreso tra 30 e 34,99 deve scrivere "Obesità lieve"
    se è compreso tra 35 e 39,99 deve scrivere "Obesità media"
    se è maggiore di 40 deve scrivere "Obesità grave"

    Io ho scritto questo ma non mi funziona, dove sbaglio????

    Ciao e grazieeeeee

    Select Case txtComposizione.Text
    Case Is < "16"
    lblRisultatoComposizione.Text = "Sottopeso grave"
    Case Is >= "16" And txtComposizione.Text <= "16,99"
    lblRisultatoComposizione.Text = "Sottopeso normale"
    Case Is >= "17" And txtComposizione.Text <= "18,49"
    lblRisultatoComposizione.Text = "Sottopeso lieve"
    Case Is >= "18,50" And txtComposizione.Text <= "24,99"
    lblRisultatoComposizione.Text = "Normopeso"
    Case Is >= "25" And txtComposizione.Text <= "29,99"
    lblRisultatoComposizione.Text = "Sovrappeso"
    Case Is >= "30" And txtComposizione.Text <= "34,99"
    lblRisultatoComposizione.Text = "Obesità lieve"
    Case Is >= "35" And txtComposizione.Text <= "39,99"
    lblRisultatoComposizione.Text = "Obesità media"
    Case Is >= "40"
    lblRisultatoComposizione.Text = "Obesità grave"
    End Select
    i7 3770K --- Asus P8z77 --- 2x4Gb Corsair Vengeance 2133MHz--- Enermax NoiseTaker II 600w --- SSD: 128Gb Vertex 4 --- WD 1000Gb --- WD 2000Gb --- ASUS ATI5850 1Gb --- Case: Kandalf 25cm Fan --- Tastiera Logitech G15 --- Mouse Razer Copperhead

  2. #2
    codice:
    Select Case CInt(txtcomposizione.Text)
                Case Is < 16
                    lblRisultatoComposizione.Text = "Sottopeso grave"
                Case 16 To 16.99
                    lblRisultatoComposizione.Text = "Sottopeso normale"
                Case 17 To 18.49
                    lblRisultatoComposizione.Text = "Sottopeso lieve"
                Case 18.5 To 24.99
                    lblRisultatoComposizione.Text = "Normopeso"
                Case 25 To 29.99
                    lblRisultatoComposizione.Text = "Sovrappeso"
                Case 30 To 34.99
                    lblRisultatoComposizione.Text = "Obesità lieve"
                Case 35 To 39.99
                    lblRisultatoComposizione.Text = "Obesità media"
                Case Is >= 40
                    lblRisultatoComposizione.Text = "Obesità grave"
            End Select

  3. #3

    Ok

    Ok grazieeeeeeeeee
    i7 3770K --- Asus P8z77 --- 2x4Gb Corsair Vengeance 2133MHz--- Enermax NoiseTaker II 600w --- SSD: 128Gb Vertex 4 --- WD 1000Gb --- WD 2000Gb --- ASUS ATI5850 1Gb --- Case: Kandalf 25cm Fan --- Tastiera Logitech G15 --- Mouse Razer Copperhead

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.