Visualizzazione dei risultati da 1 a 7 su 7
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2001
    Messaggi
    30

    [VB6] routine troppo grande

    sto facendo un prg e' vb6 mi da' questo errore di compilazione : routine troppo grande!


    ringrazio per una cortese risposta

    Saluti.

  2. #2
    spaccala in + routine la routine può pesare al max 64k
    Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2001
    Messaggi
    30
    E come di grazia?


    codice:
    Private Sub Form_Load()
    
    Private Sub Form_Load()
     Dim sq$(10), st$(5), sqf$(5), risc(5), risf(5), pu(40)
     
    Dim punti() As Integer
    Dim Classifica(1000) As Integer
    Dim Stringa As String
    
    Dim Numerosquadre As Integer
    Dim ni As Integer
    
    pun = 0
    peso0 = 1500
    peso1 = 1500
    peso2 = 1500
    peso3 = 1500
    peso4 = 1500
    peso5 = 1500
    peso6 = 1500
    peso7 = 1500
    peso8 = 1500
    peso9 = 1500
    
    vin0 = 0
    vinfc0 = 0
    
    
    v = 0
    Static c As Integer
    c = 0
    somma0 = 0
    
    On Error GoTo NotExist
        'Se non viene aperto (errore) in file non esiste
        Close #1
        Open "Austria.txt" For Input As #1
       
        fileexist = True
        'Se viene aperto il file esiste
        If fileexist = True Then GoTo 10
    NotExist:
        fileexist = False
    
    If fileexist = False Then GoTo 100
    
    
    10 For j = 0 To 9
    Input #1, sq$(j)
    
    Text1(j) = sq$(j)
    
    Next j
    Close #1
    
    
    
    
    
    
    
    For k = 1 To 40
    c = c + 1
    
    Open "Austriaris" & Trim(CStr(c)) & ".TXT" For Input As #1
    
    
     fileexist = True
        'Se viene aperto il file esiste
        If fileexist = True Then GoTo 20
    NotExist2:
        fileexist = False
    
    If fileexist = False Then GoTo 100
    
    
    
    20 For x = 0 To 4
    Input #1, st$(x), sqf$(x), risc(x), risf(x)
    
    
    
    
    Next x
    
    
    
    Close #1
    
    
    
    For j = 0 To 9
    Text2(j) = c
    Next
    
    
    For x = 0 To 4
    If Text1(0) = st$(x) And risc(x) > risf(x) Then pu(c) = pun + 3: somma0 = somma0 + pu(c): Text3(0) = somma0: vin0 = vin0 + 1
    If Text1(0) = st$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma0 = somma0 + pu(c): Text3(0) = somma0
    If Text1(0) = sqf$(x) And risc(x) > risf(x) Then pu(c) = pun + 0: somma0 = somma0 + pu(c): Text3(0) = somma0
    If Text1(0) = sqf$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma0 = somma0 + pu(c): Text3(0) = somma0
    If Text1(0) = sqf$(x) And risc(x) < risf(x) Then pu(c) = pun + 3: somma0 = somma0 + pu(c): Text3(0) = somma0: vinfc0 = vinfc0 + 1
    
    If Text1(0) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 And risf(x) < 2 Then peso0 = peso0 + 25
    If Text1(0) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso0 = peso0 + 50
    If Text1(0) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso0 = peso0 + 100
    If Text1(0) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso0 = peso0 + 150
    If Text1(0) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso0 = peso0 + 250
    
    If Text1(0) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso0 = peso0 + 35
    If Text1(0) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso0 = peso0 + 50
    If Text1(0) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso0 = peso0 + 115
    If Text1(0) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso0 = peso0 + 175
    If Text1(0) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso0 = peso0 + 300
    
    If Text1(0) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso0 = peso0 - 35
    If Text1(0) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso0 = peso0 - 65
    If Text1(0) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso0 = peso0 - 115
    If Text1(0) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso0 = peso0 - 175
    If Text1(0) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso0 = peso0 - 300
    
    If Text1(0) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso0 = peso0 - 25
    If Text1(0) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso0 = peso0 - 50
    If Text1(0) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso0 = peso0 - 100
    If Text1(0) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso0 = peso0 - 150
    If Text1(0) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso0 = peso0 - 250
    
    
    
    
    
    If Text1(1) = st$(x) And risc(x) > risf(x) Then pu(c) = pun + 3: somma1 = somma1 + pu(c): Text3(1) = somma1: vin2 = vin2 + 1
    If Text1(1) = st$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma1 = somma1 + pu(c): Text3(1) = somma1
    If Text1(1) = sqf$(x) And risc(x) > risf(x) Then pu(c) = pun + 0: somma1 = somma1 + pu(c): Text3(1) = somma1
    If Text1(1) = sqf$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma1 = somma1 + pu(c): Text3(1) = somma1
    If Text1(1) = sqf$(x) And risc(x) < risf(x) Then pu(c) = pun + 3: somma1 = somma1 + pu(c): Text3(1) = somma1: vin3 = vin3 + 1
    
    If Text1(1) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso0 = peso0 + 25
    If Text1(1) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso0 = peso0 + 50
    If Text1(1) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso0 = peso0 + 100
    If Text1(1) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso0 = peso0 + 150
    If Text1(1) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso0 = peso0 + 250
    
    If Text1(1) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso1 = peso1 + 35
    If Text1(1) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso1 = peso1 + 50
    If Text1(1) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso1 = peso1 + 115
    If Text1(1) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso1 = peso1 + 175
    If Text1(1) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso1 = peso1 + 300
    
    If Text1(1) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso1 = peso1 - 35
    If Text1(1) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso1 = peso1 - 65
    If Text1(1) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso1 = peso1 - 115
    If Text1(1) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso1 = peso1 - 175
    If Text1(1) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso1 = peso1 - 300
    
    If Text1(1) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso1 = peso1 - 25
    If Text1(1) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso1 = peso1 - 50
    If Text1(1) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso1 = peso1 - 100
    If Text1(1) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso1 = peso1 - 150
    If Text1(1) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso1 = peso1 - 250
    
    If Text1(2) = st$(x) And risc(x) > risf(x) Then pu(c) = pun + 3: somma2 = somma2 + pu(c): Text3(2) = somma2: vin4 = vin4 + 1
    If Text1(2) = st$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma2 = somma2 + pu(c): Text3(2) = somma2
    If Text1(2) = sqf$(x) And risc(x) > risf(x) Then pu(c) = pun + 0: somma2 = somma2 + pu(c): Text3(2) = somma2
    If Text1(2) = sqf$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma2 = somma2 + pu(c): Text3(2) = somma2
    If Text1(2) = sqf$(x) And risc(x) < risf(x) Then pu(c) = pun + 3: somma2 = somma2 + pu(c): Text3(2) = somma2: vinf4 = vinf4 + 1
    
    If Text1(2) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso2 = peso2 + 35
    If Text1(2) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso2 = peso2 + 50
    If Text1(2) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso2 = peso2 + 115
    If Text1(2) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso2 = peso2 + 175
    If Text1(2) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso2 = peso2 + 300
    
    If Text1(2) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso2 = peso2 - 35
    If Text1(2) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso2 = peso2 - 65
    If Text1(2) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso2 = peso2 - 115
    If Text1(2) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso2 = peso2 - 175
    If Text1(2) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso2 = peso2 - 300
    
    If Text1(2) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso2 = peso2 - 25
    If Text1(2) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso2 = peso2 - 50
    If Text1(2) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso2 = peso2 - 100
    If Text1(2) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso2 = peso2 - 150
    If Text1(2) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso2 = peso2 - 250
    
    If Text1(2) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso2 = peso2 + 25
    If Text1(2) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso2 = peso2 + 50
    If Text1(2) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso2 = peso2 + 100
    If Text1(2) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso2 = peso2 + 150
    If Text1(2) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso2 = peso2 + 250
    
    If Text1(3) = st$(x) And risc(x) > risf(x) Then pu(c) = pun + 3: somma3 = somma3 + pu(c): Text3(3) = somma3: vin5 = vin5 + 1
    If Text1(3) = st$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma3 = somma3 + pu(c): Text3(3) = somma3
    If Text1(3) = sqf$(x) And risc(x) > risf(x) Then pu(c) = pun + 0: somma3 = somma3 + pu(c): Text3(3) = somma3
    If Text1(3) = sqf$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma3 = somma3 + pu(c): Text3(3) = somma3
    If Text1(3) = sqf$(x) And risc(x) < risf(x) Then pu(c) = pun + 3: somma3 = somma3 + pu(c): Text3(3) = somma3: vinf5 = vinf5 + 1
    
    If Text1(3) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso3 = peso3 + 35
    If Text1(3) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso3 = peso3 + 50
    If Text1(3) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso3 = peso3 + 115
    If Text1(3) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso3 = peso3 + 175
    If Text1(3) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso3 = peso3 + 300
    
    If Text1(3) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 Then peso3 = peso3 - 35
    If Text1(3) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso3 = peso3 - 65
    If Text1(3) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso3 = peso3 - 115
    If Text1(3) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso3 = peso3 - 175
    If Text1(3) = st$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso3 = peso3 - 300
    
    If Text1(3) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso3 = peso3 - 25
    If Text1(3) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso3 = peso3 - 50
    If Text1(3) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso3 = peso3 - 100
    If Text1(3) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso3 = peso3 - 150
    If Text1(3) = sqf$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso3 = peso3 - 250
    
    If Text1(3) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 1 Then peso3 = peso3 + 25
    If Text1(3) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 2 Then peso3 = peso3 + 50
    If Text1(3) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 3 Then peso3 = peso3 + 100
    If Text1(3) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 4 Then peso3 = peso3 + 150
    If Text1(3) = st$(x) And risc(x) > risf(x) And risc(x) > risf(x) + 5 Then peso3 = peso3 + 250
    
    
    If Text1(4) = st$(x) And risc(x) > risf(x) Then pu(c) = pun + 3: somma4 = somma4 + pu(c): Text3(4) = somma4: vin6 = vin6 + 1
    If Text1(4) = st$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma4 = somma4 + pu(c): Text3(4) = somma4
    If Text1(4) = sqf$(x) And risc(x) > risf(x) Then pu(c) = pun + 0: somma4 = somma4 + pu(c): Text3(4) = somma4
    If Text1(4) = sqf$(x) And risc(x) = risf(x) Then pu(c) = pun + 1: somma4 = somma4 + pu(c): Text3(4) = somma4
    If Text1(4) = sqf$(x) And risc(x) < risf(x) Then pu(c) = pun + 3: somma4 = somma4 + pu(c): Text3(4) = somma4: vinf6 = vinf6 + 1
    
    If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 1 And risf(x) < 2 Then peso4 = peso4 + 35
    If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 2 Then peso4 = peso4 + 50
    If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 3 Then peso4 = peso4 + 115
    If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 4 Then peso4 = peso4 + 175
    If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso4 = peso4 + 300
    
    
    
    
    
    
    continua....
    
    end sub

    codice allegato un po' lunghetto!


    ringrazio per una tua cortese risposta

  4. #4
    per il come devi raggruppare parti di codice in altre funzioni e richiamarle dalla principale mica l'ho deciso io che peso devono avere le routine
    di grazia
    Vascello fantasma dei mentecatti nonchè baronetto della scara corona alcolica, piccolo spuccello di pezza dislessico e ubriaco- Colui che ha modificato l'orribile scritta - Gran Evacuatore Mentecatto - Tristo Mietitore Mentecatto chi usa uTonter danneggia anche te

  5. #5
    Beh a guardare il codice potresti usare

    With, Array, Select Case e volendo ce ne sono ancora di cose ...

  6. #6
    Utente di HTML.it L'avatar di LMondi
    Registrato dal
    Sep 2004
    Messaggi
    1,291
    Se proprio non puoi rendere più compatto il codice, o se lo vuoi fare in un secondo momento, per superare la situazione attuale potresti inserire in un punto che deciderai, ad esempio dopo "If Text1(4) = sqf$(x) And risc(x) < risf(x) And risc(x) < risf(x) + 5 Then peso4 = peso4 + 300" il comando "Call SecondaParte" ed in un modulo bas continuare la routine con "Public Sub - o Private Sub - SecondaParte()" e così via in altri moduli se necessario.
    Ciao.
    LM

  7. #7
    Imparare a rendere il codice piu' performante no eh ???

    Guarda che se una routine la fai in 100 righe al posto di 200 la macchina è piu' contenta non credere ...


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.