Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #19379 > unrolled thread
| Started by | "Ettore" <ettor50@nomail.com> |
|---|---|
| First post | 2018-06-10 10:08 +0200 |
| Last post | 2018-07-25 16:30 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to it.comp.lang.visual-basic
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
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-06-10 10:08 +0200 |
| Subject | Probl: Insieme di Variabili, 1 da prendere se. |
| Message-ID | <pfima4$tht$1@dont-email.me> |
Buongiorno a tutti voi e buona domenica. Sto trasferendo in VB.NET Visual Studio 2017, parte dei calcoli che ho in excel. Ho questo algoritmo "Lettera Domenicale" =SE(Anno<1600;"n/a";SE(Anno>=10000;"outdate";( (CERCA.VERT((RESTO(Anno+8;28)+1);Tavola1!M133:N160;2))))) HO UNA TAVOLA M133:N160 Questa sotto. ============================================ Numero solare e Lettera Domenicale n°sol LettD 1 FE 2 D 3 C 4 B 5 AG 6 F 7 E 8 D 9 CB 10 A 11 G 12 F 13 ED 14 C 15 B 16 A 17 GF 18 E 19 D 20 C 21 BA 22 G 23 F 24 E 25 DC 26 B 27 A 28 G ============================================ Traslandola in VB.NET ho iniziato scrivendo Dim letdom As Integer If (Anno < 1600 Or >1000) Then letdom = "Outdate" Come posso proseguire perche' mi accorgo che sono ben 28 dati .E non so come gestirmeli. GRAZIE. PS il " (RESTO(Anno+8;28) " diventa ((Anno+8) Mod 28)+1
[toc] | [next] | [standalone]
| From | Luca D <antaniserse@yahoo.it> |
|---|---|
| Date | 2018-06-11 23:55 -0700 |
| Message-ID | <7f2b14c7-c7f0-4472-8afc-1b3404064c79@googlegroups.com> |
| In reply to | #19379 |
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
[toc] | [prev] | [next] | [standalone]
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-07-24 21:03 +0200 |
| Message-ID | <pj7t73$bug$1@dont-email.me> |
| In reply to | #19381 |
Ciao Luca Grazie, sono riuscito a risolvere .! Buona giornata e mi scuso per il ritardo, oramai ci avevo messo una pietra sopra, visto che il gruppo oramai non c'e' piu nessuno =================================================== "Luca D" ha scritto nel messaggio news:7f2b14c7-c7f0-4472-8afc-1b3404064c79@googlegroups.com...
[toc] | [prev] | [next] | [standalone]
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-07-25 16:30 +0200 |
| Message-ID | <pja1hv$ir$1@dont-email.me> |
| In reply to | #19381 |
"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
[toc] | [prev] | [standalone]
Back to top | Article view | it.comp.lang.visual-basic
csiph-web