Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.lang.visual-basic > #19358 > unrolled thread
| Started by | "Ettore" <ettor50@nomail.com> |
|---|---|
| First post | 2018-05-10 15:26 +0200 |
| Last post | 2018-05-15 17:03 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to it.comp.lang.visual-basic
Texbox e stringa il risultato ? "Ettore" <ettor50@nomail.com> - 2018-05-10 15:26 +0200
Re: Texbox e stringa il risultato ? "Ettore" <ettor50@nomail.com> - 2018-05-10 21:25 +0200
Re: Texbox e stringa il risultato ? "Sauro" <vicchi@crsscala.it> - 2018-05-11 09:19 +0200
Re: Texbox e stringa il risultato ? "Ettore" <ettor50@nomail.com> - 2018-05-11 16:14 +0200
Re: Texbox e stringa il risultato ? "Sauro" <vicchi@crsscala.it> - 2018-05-15 08:37 +0200
Re: Texbox e stringa il risultato ? "Ettore" <ettor50@nomail.com> - 2018-05-15 17:03 +0200
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-05-10 15:26 +0200 |
| Subject | Texbox e stringa il risultato ? |
| Message-ID | <pd1h9s$pot$1@dont-email.me> |
Texbox e stringa
Salve a tutti del gruppo Visual Basic Italia
Sto cercando di imparare e mi piacerebbe vedere altri listati con molte
possibilita' e varie tipologie, purtroppo non riesco a trovare quello che
vorrei.
Sapete se esiste un sito di sorgenti che abbia molti listati ?
Adesso mi trovo ad avere un problema.
Ho un pulsante dove mi calcola molte cose e .. dopo essere riuscito a
inserire l'algoritmo del giorno giuliano se non con varie fatiche.........
Sono riuscito a fare alcune cose.
Ora dovrei calcolare il giorno della settimana da un JD.
Perché non riesco a ottenerlo da una data inserita.
Ora da questo listato che è' sotto, ho necessità alla fine di ottenere il
giorno della settimana, ma non so' come mettere. ovviamente è una stringa.
===================================
Variabili Dim gia' definita.
Dim Ocell As Decimal
Dim ggSett As String
--------------------------------------------
Ocell = (Int(365.25 * (Anno + 4716)) + Int(30.6001 * (mese + 1)) + giorno +
B - 1524.5)
' --------------------------- Qui riutilizzo il Valore per re inserirlo
sotto, per il risultato.
Ocell = CDec(Ocell)
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 0) Then
ggSett = Lunedì
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 1) Then
ggSett = Martedì
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 2) Then
ggSett = Mercoledì
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 3) Then
ggSett = Giovedì
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 4) Then
ggSett = Venerdì
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 5) Then
ggSett = Sabato
End If
If (((Ocell - (7 * Fix(Ocell / 7))) + 0.5) = 6) Then
ggSett = Domenica
End If
TextBox10.Text = ggSett Come ottengo qui la stringa dalla
risultante del calcolo ? ..
------------------------------
Inoltre dal giorno giuliano, qualcuno sa' come ottenere il giorno dell'anno
"in numero" da una data inserita ! (In esempi) da poter imparare.
Come si ottiene l'algoritmo del giorno bisestile in "VB.NET" da una data
inserita ?
Grazie a chiunque risponde.
[toc] | [next] | [standalone]
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-05-10 21:25 +0200 |
| Message-ID | <pd26c2$asr$1@dont-email.me> |
| In reply to | #19358 |
Sono riuscito a risolvere con un pizzico di fortuna e tante prove.
Dim ggSett As String
If (((Ocell + 0.5) Mod 7) = 0) Then
ggSett = "Lunedi"
End If
If (((Ocell + 0.5) Mod 7) = 1) Then
ggSett = "Martedi"
End If
If (((Ocell + 0.5) Mod 7) = 2) Then
ggSett = "Mercoledi"
End If
If (((Ocell + 0.5) Mod 7) = 3) Then
ggSett = "Giovedi"
End If
If (((Ocell + 0.5) Mod 7) = 4) Then
ggSett = "Venerdi"
End If
If (((Ocell + 0.5) Mod 7) = 5) Then
ggSett = "Sabato"
End If
If (((Ocell + 0.5) Mod 7) = 6) Then
ggSett = "Domenica"
End If
TextBox10.Text = ggSett
=====================================================
Mi rimane sempre il problema di come fare a
1) Come fare a trovare il Giorno dell'anno dalla data inserita.
Con le variabili inserite in una textbox
Dim giorno As Integer = Val(TextBox1.Text)
Dim mese As Integer = Val(TextBox2.Text)
Dim Anno As Integer = Val(TextBox3.Text)
Dim Ora As Integer = Val(TextBox4.Text)
Dim min As Integer = Val(TextBox5.Text)
Dim sec As Integer = Val(TextBox6.Text)
Dim secSS As Integer = Val(TextBox7.Text)
.................................................................
l'algoritmo e inserirlo in una textbox
.--------------
2) troare algoritmo giorno bisestile. E inserirlo in una textbox. Il
Range -15000 +15000 anni .
Come sempre VB.NET
Un cordiale a tutti e condivido !
[toc] | [prev] | [next] | [standalone]
| From | "Sauro" <vicchi@crsscala.it> |
|---|---|
| Date | 2018-05-11 09:19 +0200 |
| Message-ID | <pd3g63$dc5$1@gioia.aioe.org> |
| In reply to | #19359 |
> Mi rimane sempre il problema di come fare a > 1) Come fare a trovare il Giorno dell'anno dalla data inserita. In VB6 esiste la funzione Day(); in VB.NET non esiste una serie di funzioni standard? Ciao, Sauro
[toc] | [prev] | [next] | [standalone]
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-05-11 16:14 +0200 |
| Message-ID | <pd48h6$tqa$1@dont-email.me> |
| In reply to | #19360 |
>"Sauro" ha scritto nel messaggio news:pd3g63$dc5$1@gioia.aioe.org...
>> Mi rimane sempre il problema di come fare a
>> 1) Come fare a trovare il Giorno dell'anno dalla data inserita.
>In VB6 esiste la funzione Day(); in VB.NET non esiste una
>serie di funzioni standard?
>Ciao, Sauro
Ciao Sauro ..
Le uniche cose trovate sono queste, uno l'algoritmo che ho in excel, che
debbo convertire e
questa parte di codice.
=(SE(O(RESTO(Anno;400)=0;E(RESTO(Anno;4)=0;RESTO(Anno;100)<>0));"SI"; "NO"))
If TextBox3.text = "" Then
MsgBox("Anno non indicato")
If (DateTime.IsLeapYear(Integer.Parse(TextBox3.Text)) = True) Then
TextBox11.Text = "Anno " & TextBox1.Text & " bisestile."
Else
TextBox11.Text = "Anno " & TextBox1.Text & " NON bisestile."
End If
End If
nella prima sto cercando di ragionare e ottenere un risultato, ma sono
ancora in alto mare.........
codiali.
PS inerente la tua domanda ho googlato in questo modo, devo solo cercare tra
i risultati........
https://www.google.it/search?q=VB.Net+giorno+dell%27anno+da+data+inserita&oq=VB.Net+giorno+dell%27anno+da+data+inserita&aqs=chrome..69i57.10591j0j7&sourceid=chrome&ie=UTF-8
[toc] | [prev] | [next] | [standalone]
| From | "Sauro" <vicchi@crsscala.it> |
|---|---|
| Date | 2018-05-15 08:37 +0200 |
| Message-ID | <pddv7o$1eat$1@gioia.aioe.org> |
| In reply to | #19361 |
Pur non conoscendolo non posso credere che
VB.NET non abbia una serie di funzioni standard.
Ciao Ettore
Sauro
"Ettore" <ettor50@nomail.com> ha scritto nel messaggio
news:pd48h6$tqa$1@dont-email.me...
> >"Sauro" ha scritto nel messaggio news:pd3g63$dc5$1@gioia.aioe.org...
>>> Mi rimane sempre il problema di come fare a
>>> 1) Come fare a trovare il Giorno dell'anno dalla data inserita.
>
>>In VB6 esiste la funzione Day(); in VB.NET non esiste una
>>serie di funzioni standard?
>>Ciao, Sauro
>
>
> Ciao Sauro ..
> Le uniche cose trovate sono queste, uno l'algoritmo che ho in excel, che
> debbo convertire e
> questa parte di codice.
> =(SE(O(RESTO(Anno;400)=0;E(RESTO(Anno;4)=0;RESTO(Anno;100)<>0));"SI";
> "NO"))
>
> If TextBox3.text = "" Then
> MsgBox("Anno non indicato")
> If (DateTime.IsLeapYear(Integer.Parse(TextBox3.Text)) = True) Then
> TextBox11.Text = "Anno " & TextBox1.Text & " bisestile."
> Else
> TextBox11.Text = "Anno " & TextBox1.Text & " NON bisestile."
> End If
> End If
>
>
> nella prima sto cercando di ragionare e ottenere un risultato, ma sono
> ancora in alto mare.........
> codiali.
>
> PS inerente la tua domanda ho googlato in questo modo, devo solo cercare
> tra i risultati........
> https://www.google.it/search?q=VB.Net+giorno+dell%27anno+da+data+inserita&oq=VB.Net+giorno+dell%27anno+da+data+inserita&aqs=chrome..69i57.10591j0j7&sourceid=chrome&ie=UTF-8
>
[toc] | [prev] | [next] | [standalone]
| From | "Ettore" <ettor50@nomail.com> |
|---|---|
| Date | 2018-05-15 17:03 +0200 |
| Message-ID | <pdest1$dg0$1@dont-email.me> |
| In reply to | #19362 |
RISOLTO
--------------------------------------------------------------------------
>"Sauro" ha scritto nel messaggio news:pddv7o$1eat$1@gioia.aioe.org... Pur
>non conoscendolo non posso credere che
>VB.NET non abbia una serie di funzioni standard.
>Ciao Ettore
>Sauro
>> Mi rimane sempre il problema di come fare a 1) Come fare a trovare il
>> Giorno dell'anno dalla data inserita.
>> Bisestile e giorno dell'anno ...
>>In VB6 esiste la funzione Day(); in VB.NET non esiste una
>>serie di funzioni standard?
>>Ciao, Sauro
>
Risolto molti problemi posto il codice per condividerlo con tutti gli altri
.
=================================================================
Public Sub Button1_Click(sender As System.Object, e As System.EventArgs)
Handles Button1.Click
Dim giorno As Integer = Val(TextBox1.Text)
Dim mese As Integer = Val(TextBox2.Text)
Dim Anno As Integer = Val(TextBox3.Text)
Dim Ora As Integer = Val(TextBox4.Text)
Dim min As Integer = Val(TextBox5.Text)
Dim sec As Integer = Val(TextBox6.Text)
Dim secSS As Integer = Val(TextBox7.Text)
Dim ycomp As Decimal
Dim hhdec As Decimal
' Dim fuso As TimeZone = TimeZone.CurrentTimeZone
' Dim oralegale As System.Globalization.DaylightTime =
fuso.GetDaylightChanges(Anno)
' Textbox X.text = Ora legale inizia " & oralegale.Start"
' Textbox X.text = Ora legale termina" & oralegale.End"
' ============== Variabili per Calcolo JD completo
==================================================
Dim I1cel As Decimal
Dim calgreg As Decimal = 1582.1015
Dim dAnno As Double
Dim A As Decimal
Dim A1 As Decimal
Dim B As Decimal
Dim B1 As Decimal
Dim TDEC As Decimal
Dim JDdayJUL As Decimal
' ================= Variabili per ggSettimana
=======================================================
Dim Ocell As Decimal
Dim Lunedi As String
Dim Martedi As String
Dim Mercoledi As String
Dim Giovedi As String
Dim Venerdi As String
Dim Sabato As String
Dim Domenica As String
' ================ CONDIZIONI PRIMA DI FARE I CALCOLI, CONTROLLA
====================================
If TextBox3.Text = "" Then
'Condizione per Anno e RANGE !
MsgBox("Inserire anno Tra 1500 - 3500dc" & vbLf & "......CORREGGI
!", MsgBoxStyle.Exclamation, "RANGE LIMIT")
TextBox3.Focus()
Else
If TextBox3.Text < 1500 Then
MsgBox("Inserire anno Tra 1500 - 3500dc" & vbLf &
"......CORREGGI !", MsgBoxStyle.Exclamation, "ANNO RANGE LIMIT")
TextBox3.Focus()
End If
End If
If TextBox8.Text = "" Then
'Condizione per Temperatura 0-70°
MsgBox("Temperatura tra 0-70°" & vbLf & "......CORREGGI !",
MsgBoxStyle.Exclamation, "TEMP° LIMITI")
TextBox8.Focus()
Else
End If
If TextBox9.Text = "" Then
'Condizione per Temperatura 0-70°
MsgBox("Atmosfera mBar Range 500 - 1200 Hpa/mBar°" & vbLf &
"......CORREGGI !", MsgBoxStyle.Exclamation, "Atm. LIMITI")
TextBox9.Focus()
Else
If TextBox9.Text < 500 Then
'Condizione per Atmosfera Limite-
MsgBox("Atmosfera mBar Range 500 - 1200 Hpa/mBar°" & vbLf &
"......CORREGGI !", MsgBoxStyle.Exclamation, "Atm. LIMITI")
TextBox9.Focus()
End If
End If
' ========================= INIZIO CALCOLI
==========================================================
' ==================== CALCOLO GIORNO GIULIANO MINORE PER ARRIVARE AL
GIORNO DELLA SETTIMANA=========
If mese > 2 Then
Anno = Anno And mese = mese
End If
If mese <= 2 Then
Anno = Anno - 1
mese = mese + 12
End If
If Anno < calgreg Then
A = 0
B = 0
End If
If Anno >= calgreg Then
A = Int(Anno / 100)
B = 2 - A + Int(A / 4)
End If
Ocell = Int(365.25 * (Anno + 4716)) + Int(30.6001 * (mese + 1)) +
giorno + B - 1524.5
' TextBox10.Text = Round(Ocell, 6) USATO x Test
' ================== DA SOPRA CALCOLA JD MINORE E ARRIVO AL GIORNO
DELLA SETTIMANA DA ALGORITMO.=====
Dim ggSett As String
If (((Ocell + 0.5) Mod 7) = 0) Then
ggSett = "Lunedi"
End If
If (((Ocell + 0.5) Mod 7) = 1) Then
ggSett = "Martedi"
End If
If (((Ocell + 0.5) Mod 7) = 2) Then
ggSett = "Mercoledi"
End If
If (((Ocell + 0.5) Mod 7) = 3) Then
ggSett = "Giovedi"
End If
If (((Ocell + 0.5) Mod 7) = 4) Then
ggSett = "Venerdi"
End If
If (((Ocell + 0.5) Mod 7) = 5) Then
ggSett = "Sabato"
End If
If (((Ocell + 0.5) Mod 7) = 6) Then
ggSett = "Domenica"
End If
TextBox10.Text = ggSett
' ========================= CALCOLA SE ANNO E BISESTILE
==============================================
'
=(SE(O(RESTO(Anno;400)=0;E(RESTO(Anno;4)=0;RESTO(Anno;100)<>0));"SI"; "NO"))
Dim gbisxt As Integer = CInt(TextBox3.Text)
If Date.IsLeapYear(gbisxt) = True Then
TextBox11.Text = "SI"
Else
TextBox11.Text = "NO"
End If
' ========================= CALCOLO numero giorno nell'ANNO
===================================================
Dim ggnoY As Integer
Dim dataSer As Date = DateSerial(Anno, mese, giorno)
ggnoY = DatePart(DateInterval.DayOfYear, dataSer)
TextBox12.Text = ggnoY
' ========================= Calcolo Numero giorni contenuti in anno
=================================
Dim numDayear As Decimal
If (Anno Mod 400) = 0 Then
numDayear = 366
End If
If (Anno Mod 100) = 0 Then
numDayear = 365
End If
If (Anno Mod 4) = 0 Then
numDayear = 366
Else
numDayear = 365
End If
TextBox13.Text = numDayear
' ==================== Calcola numero giorni a fine anno
============================================
Dim ggiFineAnno As Decimal
ggiFineAnno = (numDayear - ggnoY)
TextBox14.Text = ggiFineAnno
' ============== Calcolo Numero Settimana dell'Anno
===================[settimana/txtsettimana]====OK
Dim numSett As Double
TextBox15.Text = Int(ggnoY / 7)
=================================================
Sistema Operativo Windows 7 64b
MS Visual Studio 2017.enterpr. -v.15.7.1 - MSNET:4.7.02558.
Grazie per ogni consiglio che date, condivido per aiutare chi ha bisogno.
Ettore
[toc] | [prev] | [standalone]
Back to top | Article view | it.comp.lang.visual-basic
csiph-web