🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #1582

Re: Combobox_risposta tardiva

#1582
From: M.M.
Date: Mon, 12 Apr 2004 11:59
69 lines
2619 bytes
Innanzitutto una buona indentazione gi� risolve 2/3 del tuo problema! Di
seguito il codice da te digitato inizialmente con l'indentazione corretta:

' Se = "Rosso" colora di rosso, altrimenti esce direttamente! A causa del
secondo IF che � nidificato con il primo, quindi non diventer� mai verde il
form

If Combo1.Text = "Rosso" Then

    Combo1.BackColor = vbRed

    If Combo1.Text = "Verde" Then
        Form1.BackColor = vbGreen
    End If

End If

Al massimo poteva essere come segue:

If Combo1.Text = "Rosso" Then

    Combo1.BackColor = vbRed

elseif  Combo1.Text = "Verde" Then

        Form1.BackColor = vbGreen

End If

Nel caso di pi� colori era consigliabile utilizzare un "select case" (un p�
meno performante dell'IF)

select case Combo1.Text
    case "Verde"
            Form1.BackColor = vbGreen
    case "Rosso"
            Combo1.BackColor = vbRed
    case "Nero"
            'istruzioni.....
end select


Saluti,
Marco.


"Andreij" <andreijlontanoff(hai visto mai?)@katamail.com> ha scritto nel
messaggio news:zbAdc.34809$hc5.1527219@news3.tin.it...
> Ho modificato in questa maniera:
>
> Private Sub Combo1_Click()
>  If Combo1.Text = "Rosso" Then
>  Combo1.BackColor = vbRed
>  Else
>  Combo1.BackColor = vbGreen
>  End If
>
> End Sub
>
>
> Tuttavia, restano le mie perplessit� e ancora non ho capito perch� non
> funzionava come l'avevo scritto prima. Anche perch� se i colori fossero 24
> invece che 2?
>
> cmq grazie
>
>
>
Technical Details
Message-ID: <Swvec.123831$FJ6.4698289@twister1.libero.it>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed.freenet.de!x-privat.org!inn1.libero.it!twister1.libero.it.POSTED!not-for-mail
References: <Oqadc.29045$hc5.1301275@news3.tin.it> <c55pr3$1u$1@fata.cs.interbusiness.it> <zbAdc.34809$hc5.1527219@news3.tin.it>

Show Full Headers
Complete Article Headers
X-Google-Language: ITALIAN,ASCII
X-Google-Thread: f94ee,140ed68c55974d69
X-Google-Attributes: gidf94ee,public
X-Google-ArrivalTime: 2004-04-12 04:59:47 PST
From: "M.M." <master74@libero.it>
Newsgroups: free.it.visual-basic
References: <Oqadc.29045$hc5.1301275@news3.tin.it> <c55pr3$1u$1@fata.cs.interbusiness.it> <zbAdc.34809$hc5.1527219@news3.tin.it>
Subject: Re: Combobox_risposta tardiva
Lines: 71
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <Swvec.123831$FJ6.4698289@twister1.libero.it>
Date: Mon, 12 Apr 2004 11:59:46 GMT
NNTP-Posting-Host: 151.25.175.74
X-Complaints-To: abuse@libero.it
X-Trace: twister1.libero.it 1081771186 151.25.175.74 (Mon, 12 Apr 2004 13:59:46 MET DST)
NNTP-Posting-Date: Mon, 12 Apr 2004 13:59:46 MET DST
Organization: [Infostrada]
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed.freenet.de!x-privat.org!inn1.libero.it!twister1.libero.it.POSTED!not-for-mail