Novità

come si scrive la radice quadrata in SpazioLight

Zetrix

Advanced Premium Member
ciao a tutti,
qualcuno sa come si scrive la radice quadrata in vb.net ?

in Spaziometria si scrive Sqr ma in SpazioLight da errore lo script
forse perche le librerie sono diverse da Spaziometria

Codice:
Class Script
    Sub Main
        Dim Nu(9),a(5),Na(10),aN(5),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim x , y , b, c ,d, e , k, s , r , es ,Ruota As Integer
        Dim ini As Integer = EstrazioniArchivio
        Dim fin As Integer = EstrazioniArchivio
        Dim T()  As String
        T = {" Ruota "," EE1 "," EE2 "," EE3 "," EE4 "," EE5 " ," Ruota "," Sqr1"," Sqr2"," Sqr3"," Sqr4"," Sqr5 "," Ruota ","  Data "}
        Call InitTabella(T,RGB(0,0,255),,,RGB(200,155,255),,"Dubai Light")
        For es = ini To fin
            For Ruota = 1 To 11
                aN(1) = Estratto(es,Ruota,1)
                aN(2) = Estratto(es,Ruota,2)
                aN(3) = Estratto(es,Ruota,3)
                aN(4) = Estratto(es,Ruota,4)
                aN(5) = Estratto(es,Ruota,5)
                a(1) = Sqr(Estratto(es,Ruota,1))
                a(2) = Sqr(Estratto(es,Ruota,2))
                a(3) = Sqr(Estratto(es,Ruota,3))
                a(4) = Sqr(Estratto(es,Ruota,4))
                a(5) = Sqr(Estratto(es,Ruota,5))
                Rt(1) = Left(a(1),3)
                Rt(2) = Left(a(2),3)
                Rt(3) = Left(a(3),3)
                Rt(4) = Left(a(4),3)
                Rt(5) = Left(a(5),3)
                T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),Rt(1),Rt(2),Rt(3),Rt(4),Rt(5),NomeRuota(Ruota ),DataEstrazione(es)}
                Call AddRigaTabella(T,RGB(59,159,182),,,RGB(0,0,255),,"Dubai Light ")
                For x = 1 To 9
                    y=9
                    If aN(1) And x =  Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
                    If aN(2) And x =  Rt(2) Then Call SetColoreCellaRighe (2,RGB(255,204,0),RGB(0,0,255) )
                    If aN(3) And x =  Rt(3) Then Call SetColoreCellaRighe (3,RGB(255,204,0),RGB(0,0,255) )
                    If aN(4) And x =  Rt(4) Then Call SetColoreCellaRighe (4,RGB(255,204,0),RGB(0,0,255) )
                    If aN(5) And x =  Rt(5) Then Call SetColoreCellaRighe (5,RGB(255,204,0),RGB(0,0,255) )
                    If Rt(1) = x Then Call SetColoreCellaRighe (7,RGB(253,233,16),RGB(0,0,255))
                    If Rt(2) = x Then Call SetColoreCellaRighe (8,RGB(253,233,16),RGB(0,0,255))
                    If Rt(3) = x Then Call SetColoreCellaRighe (9,RGB(253,233,16),RGB(0,0,255))
                    If Rt(4) = x Then Call SetColoreCellaRighe (10,RGB(253,233,16),RGB(0,0,255))
                    If Rt(5) = x Then Call SetColoreCellaRighe (11,RGB(253,233,16),RGB(0,0,255))
                    If Rt(1) = y Then Call SetColoreCellaRighe (7,ColoreRosa,ColoreNero)
                    If Rt(2) = y Then Call SetColoreCellaRighe (8,ColoreRosa,ColoreNero)
                    If Rt(3) = y Then Call SetColoreCellaRighe (9,ColoreRosa,ColoreNero)
                    If Rt(4) = y Then Call SetColoreCellaRighe (10,ColoreRosa,ColoreNero)
                    If Rt(5) = y Then Call SetColoreCellaRighe (11,ColoreRosa,ColoreNero)
                    If aN(1) And y =  Rt(1) Then Call SetColoreCellaRighe (1,ColoreRosa,ColoreNero)
                    If aN(2) And y =  Rt(2) Then Call SetColoreCellaRighe (2,ColoreRosa,ColoreNero)
                    If aN(3) And y =  Rt(3) Then Call SetColoreCellaRighe (3,ColoreRosa,ColoreNero)
                    If aN(4) And y =  Rt(4) Then Call SetColoreCellaRighe (4,ColoreRosa,ColoreNero)
                    If aN(5) And y =  Rt(5) Then Call SetColoreCellaRighe (5,ColoreRosa,ColoreNero)
                    Call SetColoreCellaRighe(0,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(6,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(12,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(13,RGB(0,0,255),RGB(200,155,255))
                Next
            Next
        Next
        CreaTabella
    End Sub
End Class
 
Ultima modifica:
ho trovato questa info nel web per la radice quadrata ma non so come si dovrà scrivere nello script


Visual Basic .NET è un linguaggio di programmazione sviluppato da Microsoft per la creazione di applicazioni per il sistema operativo Microsoft Windows. Visual Basic fornisce un modo semplice per calcolare le radici quadrate attraverso l'uso della classe di matematica framework .NET.

istruzione
1 Importare la classe di matematica .NET framework includendo il seguente nella parte superiore del codice sorgente: Imports System.Math.

2 Dichiarare una variabile per memorizzare il numero che si desidera trovare la radice quadrata, utilizzando la seguente istruzione: Dim InputValue As Double.

3 Impostare il valore della InputValue uguale al valore che si desidera trovare la radice quadrata di. Per esempio, se si desidera trovare la radice quadrata di "25", digitare quanto segue: InputValue = 25.

4 Calcolare la radice quadrata chiamando il metodo .NET Framework appropriato come segue: Math.Sqrt (InputValue).
 
ho fatto una prova ma da sempre errore ho visto nel web che si scrive cosi il codice
e probabile che sia impostata male la configurazione della radice quadrata


Codice:
Class Script
    Sub Main
        Dim Nu(9),a(5),Na(10),aN(5),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim x , y , b, c ,d, e , k, s , r , es ,Ruota As Integer
        Dim radice As Double
        radice = Math.Sqrt(Val(Valore))
        Dim ini As I nteger = EstrazioniArchivio
        Dim fin As Integer = EstrazioniArchivio
        Dim T()  As String
        T = {" Ruota "," EE1 "," EE2 "," EE3 "," EE4 "," EE5 " ," Ruota "," Sqr1"," Sqr2"," Sqr3"," Sqr4"," Sqr5 "," Ruota ","  Data "}
        Call InitTabella(T,RGB(0,0,255),,,RGB(200,155,255),,"Dubai Light")
        For es = ini To fin
            For Ruota = 1 To 11
                aN(1) = Estratto(es,Ruota,1)
                aN(2) = Estratto(es,Ruota,2)
                aN(3) = Estratto(es,Ruota,3)
                aN(4) = Estratto(es,Ruota,4)
                aN(5) = Estratto(es,Ruota,5)
                a(1) = radice(Estratto(es,Ruota,1))
                a(2) = radice(Estratto(es,Ruota,2))
                a(3) = radice(Estratto(es,Ruota,3))
                a(4) = radice(Estratto(es,Ruota,4))
                a(5) = radice(Estratto(es,Ruota,5))
                Rt(1) = Left(a(1),3)
                Rt(2) = Left(a(2),3)
                Rt(3) = Left(a(3),3)
                Rt(4) = Left(a(4),3)
                Rt(5) = Left(a(5),3)
                T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),Rt(1),Rt(2),Rt(3),Rt(4),Rt(5),NomeRuota(Ruota ),DataEstrazione(es)}
                Call AddRigaTabella(T,RGB(59,159,182),,,RGB(0,0,255),,"Dubai Light ")
                For x = 1 To 9
                    y=9
                    If aN(1) And x =  Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
                    If aN(2) And x =  Rt(2) Then Call SetColoreCellaRighe (2,RGB(255,204,0),RGB(0,0,255) )
                    If aN(3) And x =  Rt(3) Then Call SetColoreCellaRighe (3,RGB(255,204,0),RGB(0,0,255) )
                    If aN(4) And x =  Rt(4) Then Call SetColoreCellaRighe (4,RGB(255,204,0),RGB(0,0,255) )
                    If aN(5) And x =  Rt(5) Then Call SetColoreCellaRighe (5,RGB(255,204,0),RGB(0,0,255) )
                    If Rt(1) = x Then Call SetColoreCellaRighe (7,RGB(253,233,16),RGB(0,0,255))
                    If Rt(2) = x Then Call SetColoreCellaRighe (8,RGB(253,233,16),RGB(0,0,255))
                    If Rt(3) = x Then Call SetColoreCellaRighe (9,RGB(253,233,16),RGB(0,0,255))
                    If Rt(4) = x Then Call SetColoreCellaRighe (10,RGB(253,233,16),RGB(0,0,255))
                    If Rt(5) = x Then Call SetColoreCellaRighe (11,RGB(253,233,16),RGB(0,0,255))
                    If Rt(1) = y Then Call SetColoreCellaRighe (7,ColoreRosa,ColoreNero)
                    If Rt(2) = y Then Call SetColoreCellaRighe (8,ColoreRosa,ColoreNero)
                    If Rt(3) = y Then Call SetColoreCellaRighe (9,ColoreRosa,ColoreNero)
                    If Rt(4) = y Then Call SetColoreCellaRighe (10,ColoreRosa,ColoreNero)
                    If Rt(5) = y Then Call SetColoreCellaRighe (11,ColoreRosa,ColoreNero)
                    If aN(1) And y =  Rt(1) Then Call SetColoreCellaRighe (1,ColoreRosa,ColoreNero)
                    If aN(2) And y =  Rt(2) Then Call SetColoreCellaRighe (2,ColoreRosa,ColoreNero)
                    If aN(3) And y =  Rt(3) Then Call SetColoreCellaRighe (3,ColoreRosa,ColoreNero)
                    If aN(4) And y =  Rt(4) Then Call SetColoreCellaRighe (4,ColoreRosa,ColoreNero)
                    If aN(5) And y =  Rt(5) Then Call SetColoreCellaRighe (5,ColoreRosa,ColoreNero)
                    Call SetColoreCellaRighe(0,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(6,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(12,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(13,RGB(0,0,255),RGB(200,155,255))
                Next
            Next
        Next
        CreaTabella
    End Sub
End Class
 
Ultima modifica:
prova cosi con spazio e vb6 , funziona
Codice:
Option Explicit
Sub Main
   Dim numero,radicequadrata
   numero = 02
   radicequadrata = numero^(01/02)
   Call Scrivi(radicequadrata)
End Sub
 
Ultima modifica:
in teoria va bene anche in spaziolight
devi provarla ,io non lo installata , perche ho xp .
o forse questa , per vbnet
Codice:
Math.Sqrt(numero)
 
questa tabella scrive con Spaziometria,per la radice quadrata di un numero si usa Sqr

Codice:
Sub Main
   Dim Nu(5),Ru(1),Q(5)
   Dim T,V,ES,X,R
   Dim A,B,C,D,E
   X = InputBox("Quante estrazioni vuoi controllare?",,0)
   For ES = EstrazioneFin - X To EstrazioneFin
      AvanzamentoElab EstrazioneFin - X,EstrazioneFin,ES
      T = Array(T,"" & DataEstrazione(ES) & "","Estratti","Sqr1","Sqr2","Sqr3","Sqr4","Sqr5")
      Call InitTabella(T,RGB(253,233,16),RGB(0,0,255))
      For R = 1 To 11
         If R = 11 Then R = 12
         A = Sqr(Estratto(ES,R,1))
         B = Sqr(Estratto(ES,R,2))
         C = Sqr(Estratto(ES,R,3))
         D = Sqr(Estratto(ES,R,4))
         E = Sqr(Estratto(ES,R,5))
         Q(1) = Left(A,4)
         Q(2) = Left(B,4)
         Q(3) = Left(C,4)
         Q(4) = Left(D,4)
         Q(5) = Left(E,4)
         Ru(1) = R
         V = Array(V,SiglaRuota(R),StringaEstratti(ES,R),(Q(1)),(Q(2)),(Q(3)),(Q(4)),(Q(5)))
         Call AddRigaTabella(V,RGB(0,214,153),RGB(0,0,255))
      Next
      Call SetTableWidth("30%")
      CreaTabella
   Next
End Sub
 
Il vb net opre con oggetti.
Per usare l'oggetto script hai usalo la class script.
Per usare sqr in vb net devi creare class mat
Ritorna sul web e cerca un esempio pratico.
 
ho provato come ai detto te ma continua a dare errore

Codice:
Class Script
    Sub Main
        Dim Nu(9),a(5),Na(10),aN(5),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim x , y , b, c ,d, e , k, s , r , es ,Ruota As Integer
        Dim numero As Double
        Dim radice
        radice = Math.Sqrt(numero)
        Dim ini As Integer = EstrazioniArchivio
        Dim fin As Integer = EstrazioniArchivio
        Dim T()  As String
        T = {" Ruota "," EE1 "," EE2 "," EE3 "," EE4 "," EE5 " ," Ruota "," Sqr1"," Sqr2"," Sqr3"," Sqr4"," Sqr5 "," Ruota ","  Data "}
        Call InitTabella(T,RGB(0,0,255),,,RGB(200,155,255),,"Dubai Light")
        For es = ini To fin
            For Ruota = 1 To 11
                aN(1) = Estratto(es,Ruota,1)
                aN(2) = Estratto(es,Ruota,2)
                aN(3) = Estratto(es,Ruota,3)
                aN(4) = Estratto(es,Ruota,4)
                aN(5) = Estratto(es,Ruota,5)
                a(1) = radice(Estratto(es,Ruota,1))
                a(2) = radice(Estratto(es,Ruota,2))
                a(3) = radice(Estratto(es,Ruota,3))
                a(4) = radice(Estratto(es,Ruota,4))
                a(5) = radice(Estratto(es,Ruota,5))
                Rt(1) = Left(a(1),3)
                Rt(2) = Left(a(2),3)
                Rt(3) = Left(a(3),3)
                Rt(4) = Left(a(4),3)
                Rt(5) = Left(a(5),3)
                T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),Rt(1),Rt(2),Rt(3),Rt(4),Rt(5),NomeRuota(Ruota ),DataEstrazione(es)}
                Call AddRigaTabella(T,RGB(59,159,182),,,RGB(0,0,255),,"Dubai Light ")
                For x = 1 To 9
                    y=9
                    If aN(1) And x =  Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
                    If aN(2) And x =  Rt(2) Then Call SetColoreCellaRighe (2,RGB(255,204,0),RGB(0,0,255) )
                    If aN(3) And x =  Rt(3) Then Call SetColoreCellaRighe (3,RGB(255,204,0),RGB(0,0,255) )
                    If aN(4) And x =  Rt(4) Then Call SetColoreCellaRighe (4,RGB(255,204,0),RGB(0,0,255) )
                    If aN(5) And x =  Rt(5) Then Call SetColoreCellaRighe (5,RGB(255,204,0),RGB(0,0,255) )
                    If Rt(1) = x Then Call SetColoreCellaRighe (7,RGB(253,233,16),RGB(0,0,255))
                    If Rt(2) = x Then Call SetColoreCellaRighe (8,RGB(253,233,16),RGB(0,0,255))
                    If Rt(3) = x Then Call SetColoreCellaRighe (9,RGB(253,233,16),RGB(0,0,255))
                    If Rt(4) = x Then Call SetColoreCellaRighe (10,RGB(253,233,16),RGB(0,0,255))
                    If Rt(5) = x Then Call SetColoreCellaRighe (11,RGB(253,233,16),RGB(0,0,255))
                    If Rt(1) = y Then Call SetColoreCellaRighe (7,ColoreRosa,ColoreNero)
                    If Rt(2) = y Then Call SetColoreCellaRighe (8,ColoreRosa,ColoreNero)
                    If Rt(3) = y Then Call SetColoreCellaRighe (9,ColoreRosa,ColoreNero)
                    If Rt(4) = y Then Call SetColoreCellaRighe (10,ColoreRosa,ColoreNero)
                    If Rt(5) = y Then Call SetColoreCellaRighe (11,ColoreRosa,ColoreNero)
                    If aN(1) And y =  Rt(1) Then Call SetColoreCellaRighe (1,ColoreRosa,ColoreNero)
                    If aN(2) And y =  Rt(2) Then Call SetColoreCellaRighe (2,ColoreRosa,ColoreNero)
                    If aN(3) And y =  Rt(3) Then Call SetColoreCellaRighe (3,ColoreRosa,ColoreNero)
                    If aN(4) And y =  Rt(4) Then Call SetColoreCellaRighe (4,ColoreRosa,ColoreNero)
                    If aN(5) And y =  Rt(5) Then Call SetColoreCellaRighe (5,ColoreRosa,ColoreNero)
                    Call SetColoreCellaRighe(0,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(6,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(12,RGB(0,0,255),RGB(200,155,255))
                    Call SetColoreCellaRighe(13,RGB(0,0,255),RGB(200,155,255))
                Next
            Next
        Next
        CreaTabella
    End Sub
End Class
 
Il vb net opre con oggetti.
Per usare l'oggetto script hai usalo la class script.
Per usare sqr in vb net devi creare class mat
Ritorna sul web e cerca un esempio pratico.
claudio scusami ma perche deve essere cosi difficile scrivere una radice quadrata di un numero
in Spaziometria si scrive cosi semplice si usa Sqr per la radice quadrata
invece in SpazioLight diventa tutto piu difficile
 
Con il consiglio di Fabri non era difficile, basta applicarlo
Codice:
Class Script
    Sub Main
        Dim numero As Integer
        Dim radicequadrata As Decimal
        numero = 636804
        radicequadrata = numero^(01/02)
        Call Scrivi(radicequadrata) ' calcolo codice in manuale
        Scrivi (Math.Sqrt(numero)) ' calcolo con codice
    End Sub
End Class

Risultato corretto delle 2 operazioni
798
798
 
Prova con SQRT,io lo uso per i programmi in CNC e mi sembra che funzioni anche su VB script
una volta ho fatto un listato sfruttando il teorema di Pitagora con le formazioni 30-60-90
 
ho provato in questo modo ma i numeri della radice quadrata sono approssimative
non scrive i decimali,
esempio sqrt (88) con la calcolatrice scrive anche i decimali 9.38
adesso come si fa a scrivere anche con i decimali dopo la virgola..

Codice:
Class Script
    Sub Main
        Dim Nu(9),a(5),Na(10),aN(5),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim x , y , b, c ,d, e , k, s , r , es ,Ruota As Integer
        Dim ini As Integer = EstrazioniArchivio
        Dim fin As Integer = EstrazioniArchivio
        Dim T()  As String
        T = {" Ruota "," EE1 "," EE2 "," EE3 "," EE4 "," EE5 " ," Ruota "," Sqr1"," Sqr2"," Sqr3"," Sqr4"," Sqr5 "," Ruota ","  Data "}
        Call InitTabella(T,RGB(0,0,255),,,RGB(200,155,255),,"Dubai Light")
        For es = ini To fin
            For Ruota = 1 To 11
                aN(1) = Estratto(es,Ruota,1)
                aN(2) = Estratto(es,Ruota,2)
                aN(3) = Estratto(es,Ruota,3)
                aN(4) = Estratto(es,Ruota,4)
                aN(5) = Estratto(es,Ruota,5)
                a(1) = Math.Sqrt(aN(1))
                a(2) = Math.Sqrt(aN(2))
                a(3) = Math.Sqrt(aN(3))
                a(4) = Math.Sqrt(aN(4))
                a(5) = Math.Sqrt(aN(5))
                Rt(1) = (a(1))
                Rt(2) = (a(2))
                Rt(3) = (a(3))
                Rt(4) = (a(4))
                Rt(5) = (a(5))
                T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),Rt(1),Rt(2),Rt(3),Rt(4),Rt(5),NomeRuota(Ruota ),DataEstrazione(es)}
                Call AddRigaTabella(T,RGB(59,159,182),,,RGB(0,0,255),,"Dubai Light ")
                'For x = 1 To 9
                y=0
                If aN(1) And x =  Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
                If aN(2) And x =  Rt(2) Then Call SetColoreCellaRighe (2,RGB(255,204,0),RGB(0,0,255) )
                If aN(3) And x =  Rt(3) Then Call SetColoreCellaRighe (3,RGB(255,204,0),RGB(0,0,255) )
                If aN(4) And x =  Rt(4) Then Call SetColoreCellaRighe (4,RGB(255,204,0),RGB(0,0,255) )
                If aN(5) And x =  Rt(5) Then Call SetColoreCellaRighe (5,RGB(255,204,0),RGB(0,0,255) )
                If Rt(1) = x Then Call SetColoreCellaRighe (7,RGB(253,233,16),RGB(0,0,255))
                If Rt(2) = x Then Call SetColoreCellaRighe (8,RGB(253,233,16),RGB(0,0,255))
                If Rt(3) = x Then Call SetColoreCellaRighe (9,RGB(253,233,16),RGB(0,0,255))
                If Rt(4) = x Then Call SetColoreCellaRighe (10,RGB(253,233,16),RGB(0,0,255))
                If Rt(5) = x Then Call SetColoreCellaRighe (11,RGB(253,233,16),RGB(0,0,255))
                If Rt(1) = y Then Call SetColoreCellaRighe (7,ColoreRosa,ColoreNero)
                If Rt(2) = y Then Call SetColoreCellaRighe (8,ColoreRosa,ColoreNero)
                If Rt(3) = y Then Call SetColoreCellaRighe (9,ColoreRosa,ColoreNero)
                If Rt(4) = y Then Call SetColoreCellaRighe (10,ColoreRosa,ColoreNero)
                If Rt(5) = y Then Call SetColoreCellaRighe (11,ColoreRosa,ColoreNero)
                If aN(1) And y =  Rt(1) Then Call SetColoreCellaRighe (1,ColoreRosa,ColoreNero)
                If aN(2) And y =  Rt(2) Then Call SetColoreCellaRighe (2,ColoreRosa,ColoreNero)
                If aN(3) And y =  Rt(3) Then Call SetColoreCellaRighe (3,ColoreRosa,ColoreNero)
                If aN(4) And y =  Rt(4) Then Call SetColoreCellaRighe (4,ColoreRosa,ColoreNero)
                If aN(5) And y =  Rt(5) Then Call SetColoreCellaRighe (5,ColoreRosa,ColoreNero)
                Call SetColoreCellaRighe(0,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(6,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(12,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(13,RGB(0,0,255),RGB(200,155,255))
                'Next
            Next
        Next
        CreaTabella
    End Sub
End Class
 
Ultima modifica:
Buongiorno a Tutti,

Purtroppo non riesco ad essere presente come vorrei, devo dare priorità ad alcuni problemi che mi lasciano poco spazio, cercando di distrarmi un pò ho voluto provare a fare delle modifiche, propongo quanto ho capito dai vari commenti ed ho fatto questo, sperando sia utile a quanto si cercava.

Codice:
Class Script
    Sub Main
        'Dim Nu(9),a(5),Na(10),aN(5),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim Nu(9),Na(10),Ru(1),Rt(5),Num1,Num2,Num3,Num4,Num5,Num6,Num7,Num8,Num9,Num10 As Integer
        Dim x , y , b, c ,d, e , k, s , r , es ,Ruota As Integer
        Dim ini As Integer = EstrazioniArchivio
        Dim fin As Integer = EstrazioniArchivio
        Dim T()  As String
        Dim aN(5),a(5) As Double   
        T = {" Ruota "," EE1 "," EE2 "," EE3 "," EE4 "," EE5 " ," Ruota "," Sqr1"," Sqr2"," Sqr3"," Sqr4"," Sqr5 "," Ruota ","  Data "}
        Call InitTabella(T,RGB(0,0,255),,,RGB(200,155,255),,"Dubai Light")
        For es = ini To fin
            For Ruota = 1 To 11
                aN(1) = Estratto(es,Ruota,1)
                aN(2) = Estratto(es,Ruota,2)
                aN(3) = Estratto(es,Ruota,3)
                aN(4) = Estratto(es,Ruota,4)
                aN(5) = Estratto(es,Ruota,5)
                a(1) = Math.Sqrt(aN(1)) 
                a(2) = Math.Sqrt(aN(2))
                a(3) = Math.Sqrt(aN(3))
                a(4) = Math.Sqrt(aN(4))
                a(5) = Math.Sqrt(aN(5))
                Rt(1) = (a(1))
                Rt(2) = (a(2))
                Rt(3) = (a(3))
                Rt(4) = (a(4))
                Rt(5) = (a(5))
                'T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),Rt(1),Rt(2),Rt(3),Rt(4),Rt(5),NomeRuota(Ruota ),DataEstrazione(es)}
                T = {NomeRuota(Ruota),aN(1),aN(2),aN(3),aN(4),aN(5),NomeRuota(Ruota),a(1),a(2),a(3),a(4),a(5),NomeRuota(Ruota ),DataEstrazione(es)}
                Call AddRigaTabella(T,RGB(59,159,182),,,RGB(0,0,255),,"Dubai Light ")
                'For x = 1 To 9
                y=0
                If aN(1) And x =  Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
                If aN(2) And x =  Rt(2) Then Call SetColoreCellaRighe (2,RGB(255,204,0),RGB(0,0,255) )
                If aN(3) And x =  Rt(3) Then Call SetColoreCellaRighe (3,RGB(255,204,0),RGB(0,0,255) )
                If aN(4) And x =  Rt(4) Then Call SetColoreCellaRighe (4,RGB(255,204,0),RGB(0,0,255) )
                If aN(5) And x =  Rt(5) Then Call SetColoreCellaRighe (5,RGB(255,204,0),RGB(0,0,255) )
                If Rt(1) = x Then Call SetColoreCellaRighe (7,RGB(253,233,16),RGB(0,0,255))
                If Rt(2) = x Then Call SetColoreCellaRighe (8,RGB(253,233,16),RGB(0,0,255))
                If Rt(3) = x Then Call SetColoreCellaRighe (9,RGB(253,233,16),RGB(0,0,255))
                If Rt(4) = x Then Call SetColoreCellaRighe (10,RGB(253,233,16),RGB(0,0,255))
                If Rt(5) = x Then Call SetColoreCellaRighe (11,RGB(253,233,16),RGB(0,0,255))
                If Rt(1) = y Then Call SetColoreCellaRighe (7,ColoreRosa,ColoreNero)
                If Rt(2) = y Then Call SetColoreCellaRighe (8,ColoreRosa,ColoreNero)
                If Rt(3) = y Then Call SetColoreCellaRighe (9,ColoreRosa,ColoreNero)
                If Rt(4) = y Then Call SetColoreCellaRighe (10,ColoreRosa,ColoreNero)
                If Rt(5) = y Then Call SetColoreCellaRighe (11,ColoreRosa,ColoreNero)
                If aN(1) And y =  Rt(1) Then Call SetColoreCellaRighe (1,ColoreRosa,ColoreNero)
                If aN(2) And y =  Rt(2) Then Call SetColoreCellaRighe (2,ColoreRosa,ColoreNero)
                If aN(3) And y =  Rt(3) Then Call SetColoreCellaRighe (3,ColoreRosa,ColoreNero)
                If aN(4) And y =  Rt(4) Then Call SetColoreCellaRighe (4,ColoreRosa,ColoreNero)
                If aN(5) And y =  Rt(5) Then Call SetColoreCellaRighe (5,ColoreRosa,ColoreNero)
                Call SetColoreCellaRighe(0,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(6,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(12,RGB(0,0,255),RGB(200,155,255))
                Call SetColoreCellaRighe(13,RGB(0,0,255),RGB(200,155,255))
                'Next
            Next
        Next
        CreaTabella
    End Sub
End Class

Penso sarebbe utile forse arrotondare almeno a due valori dopo la virgola, ma con i miei tentativi non ci sono riuscito, ma questa è solo una mia idea.

Spero di essere stato utile.
 
Ultimo suggerimento , con 2 decimali.
Poi se si vuole il numero con i decimali va dichiarato decimal e non integer (intero) come int in vbscript

vbscript


Codice:
Sub Main
   Dim a,b,c
   a = 88
   b = 888
   c = 88888
   Scrivi Round(Sqr(a),2)
   Scrivi Round(Sqr(b),2)
   Scrivi Round(Sqr(c),2)
End Sub

vbnet

Codice:
Class Script
    Sub Main
        Dim a,b,c  As Integer
        a = 88
        b = 888
        c = 88888
        Scrivi (math.Round( math.sqrt(a) ,2) )
        Scrivi (math.Round( math.sqrt(b) ,2) )
        Scrivi (math.Round( math.sqrt(c) ,2) )
    End Sub
End Class
 
Ho messo anch'io le dichiarazioni integer anche se con la radice quadrata funzionano anche in decimale.
Però poi una operazione con risultati in decimali non la riporta correttamente.
quindi coreggiamo.

Codice:
Class Script
    Sub Main
        Dim a,b,c,d  As Decimal
        a = 88
        b = 888
        c = 88888
        d = a/3
        Scrivi (math.Round( math.sqrt(a) ,2) )
        Scrivi (math.Round( math.sqrt(b) ,2) )
        Scrivi (math.Round( math.sqrt(c) ,2) )
        Scrivi ( math.Round( (d) ,2) )
    End Sub
End Class
 
Bravo Mike,
suggerisco agli amici, di non andare a tentativi, ma di cercare un manuale sul web (o esempi di codice vb.net spiegati) con i quali rafforzare le proprie basi di conoscenza del linguaggio, altrimenti la strada è sempre in salita... ;)
Premesso che non ho seguito le lezioni/ indicazioni di VB.net e non lo uso xchè ho XP, forse sarebbero da correggere anche queste righe di If

If aN(1) And x = Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
con
If aN(1) = ( una determinata cosa) And x = Rt(1) Then Call SetColoreCellaRighe (1,RGB(255,204,0),RGB(0,0,255) )
spero che in questo vb.net sia identico a vbscript.
Saluti;)
 
Ultima modifica:

Ultima estrazione Lotto

  • Estrazione del lotto
    martedì 15 luglio 2025
    Bari
    60
    18
    12
    57
    28
    Cagliari
    20
    26
    81
    55
    18
    Firenze
    28
    59
    46
    83
    81
    Genova
    32
    57
    09
    41
    17
    Milano
    58
    31
    49
    38
    63
    Napoli
    36
    58
    57
    45
    59
    Palermo
    03
    05
    48
    86
    62
    Roma
    47
    18
    01
    23
    79
    Torino
    56
    34
    49
    89
    90
    Venezia
    46
    44
    52
    82
    78
    Nazionale
    16
    36
    15
    13
    60
    Estrazione Simbolotto
    Nazionale
    27
    09
    44
    18
    11
Indietro
Alto