Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.visual-basic > #19407

Re: Probl: Insieme di Variabili, 1 da prendere se.

From "Ettore" <ettor50@nomail.com>
Newsgroups it.comp.lang.visual-basic
Subject Re: Probl: Insieme di Variabili, 1 da prendere se.
Date 2018-07-25 16:30 +0200
Organization A noiseless patient Spider
Message-ID <pja1hv$ir$1@dont-email.me> (permalink)
References <pfima4$tht$1@dont-email.me> <7f2b14c7-c7f0-4472-8afc-1b3404064c79@googlegroups.com>

Show all headers | View raw


"Luca D"  ha scritto nel messaggio 
news:7f2b14c7-c7f0-4472-8afc-1b3404064c79@googlegroups.com...

On Sunday, June 10, 2018 at 10:08:37 AM UTC+2, Ettore wrote:
> Buongiorno a tutti voi e buona domenica.
> Sto trasferendo in VB.NET Visual Studio 2017, parte dei calcoli che ho in excel.
>[cut]
> Come posso proseguire perche' mi accorgo che sono ben 28 dati .E non so come gestirmeli.

(ammesso di aver capito bene cosa devi fare)

Da qualche parte in avvio di programma, inizializza una tabellina di look-up, definita a 
livello globale o comunque con scope sufficiente, qualcosa tipo:

    Private LetteraDomenicaleTable As New Generic.Dictionary(Of Integer, String)

    LetteraDomenicaleTable.Add(1, "FE")
    LetteraDomenicaleTable.Add(2, "D")
    LetteraDomenicaleTable.Add(3, "C")
    LetteraDomenicaleTable.Add(4, "B")
    LetteraDomenicaleTable.Add(5, "AG")
    'ecc.. ecc.


Poi crei la funzione

    Function GetLetteraDomenicale(ByVal anno As Integer) As String

        If anno < 1600 Then
            Return "n/a"
        ElseIf anno > 10000 Then
            Return "outdate"
        Else
            Return LetteraDomenicaleTable(((anno + 8) Mod 28) + 1)
        End If

    End Function

=====================================================

Risolto in questo modo

' ==============CALCOLO Lettera 
Domenicale=====================================================OK
        Dim lettDom As Integer
        Dim LetD As String
        If (Anno < 1700 Or Anno > 2500) Then
            LetD = "-n/a-"
        End If
        lettDom = (((Anno + 8) Mod 28) + 1)
        If lettDom = 1 Then
            LetD = "FE"
        End If
        If lettDom = 2 Then
            LetD = "D"
        End If
        If lettDom = 3 Then
            LetD = "C"
        End If
        If lettDom = 4 Then
            LetD = "B"
        End If
        If lettDom = 5 Then
            LetD = "AG"
        End If
        If lettDom = 6 Then
            LetD = "F"
        End If
        If lettDom = 7 Then
            LetD = "E"
        End If
        If lettDom = 8 Then
            LetD = "D"
        End If
        If lettDom = 9 Then
            LetD = "CB"
        End If
        If lettDom = 10 Then
            LetD = "A"
        End If
        If lettDom = 11 Then
            LetD = "G"
        End If
        If lettDom = 12 Then
            LetD = "F"
        End If
        If lettDom = 13 Then
            LetD = "ED"
        End If
        If lettDom = 14 Then
            LetD = "C"
        End If
        If lettDom = 15 Then
            LetD = "B"
        End If
        If lettDom = 16 Then
            LetD = "A"
        End If
        If lettDom = 17 Then
            LetD = "GF"
        End If
        If lettDom = 18 Then
            LetD = "E"
        End If
        If lettDom = 19 Then
            LetD = "D"
        End If
        If lettDom = 20 Then
            LetD = "C"
        End If
        If lettDom = 21 Then
            LetD = "BA"
        End If
        If lettDom = 22 Then
            LetD = "G"
        End If
        If lettDom = 23 Then
            LetD = "F"
        End If
        If lettDom = 24 Then
            LetD = "E"
        End If
        If lettDom = 25 Then
            LetD = "DC"
        End If
        If lettDom = 26 Then
            LetD = "B"
        End If
        If lettDom = 27 Then
            LetD = "A"
        End If
        If lettDom = 28 Then
            LetD = "G"
        End If
        Dim LettDo As String = LetD
        txtlettdom.Text = LettDo 

Back to it.comp.lang.visual-basic | Previous | NextPrevious in thread | Find similar


Thread

Probl: Insieme di Variabili, 1 da prendere se. "Ettore" <ettor50@nomail.com> - 2018-06-10 10:08 +0200
  Re: Probl: Insieme di Variabili, 1 da prendere se. Luca D <antaniserse@yahoo.it> - 2018-06-11 23:55 -0700
    Re: Probl: Insieme di Variabili, 1 da prendere se. "Ettore" <ettor50@nomail.com> - 2018-07-24 21:03 +0200
    Re: Probl: Insieme di Variabili, 1 da prendere se. "Ettore" <ettor50@nomail.com> - 2018-07-25 16:30 +0200

csiph-web