Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Visual Basic 6 - gioco del lotto
Forum - Visual Basic 6 - gioco del lotto - Pagina 5

Pagine: [ 1 2 3 4 5 6 ] Precedente | Prossimo
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 16:17
Lunedì, 28/01/2008
Testo quotato

Postato originariamente da gantonio:

Ma la

For st ...

seguita subito dalla

Next
conteggio i ritardi nella lista

e la If st ... in basso ...
la if  fa partire il conteggio nel modo esatto cioè da 0---> a fine lista

altrimenti iniziaerebbe sballato, come dicevamo sopra

a cosa servono???

Scrivendo del codice a caso non fai altro che rendere inutile il resto del programma ...


PM
Avatar
gantonio (Normal User)
Guru^2


Messaggi: 1532
Iscritto: 09/09/2007

Segnala al moderatore
Postato alle 18:50
Lunedì, 28/01/2008
Lascia stare quel codice ... scrivi questo al posto di quello che hai usato fino ad ora ... mi raccomando, elimina tutto il precedente contenuto nel click del button ed usa questo

Codice sorgente - presumibilmente VB.NET

  1. Dim rs As ADODB.Recordset
  2.     Dim RUS As String
  3.     Dim RU() As String
  4.     Dim R As Integer
  5.     Dim N As Integer
  6.     Dim RN(1 To 10, 1 To 90)
  7.     Dim C(1 To 10)
  8.     Dim NN As Integer
  9.     Dim NS As String * 154
  10.     Dim v As Integer
  11.     Dim p As Integer
  12.     Dim ss As String * 2
  13.     Dim rit As Integer
  14.    
  15.     RUS = "--*BA*CA*FI*GE*MI*NA*PA*RO*TO*VE*"
  16.     RU = Split(RUS, "*")
  17.  
  18.     With List1
  19.         .Font.Name = "Terminal"
  20.         .Font.Size = 9
  21.         .Clear
  22.         NS = "RIT " & Space$(150)
  23.         For R = 1 To 10
  24.             Mid$(NS, (R - 1) * 15 + 5) = "----- " & RU(R) & " ----- "
  25.         Next R
  26.         .AddItem NS
  27.         .AddItem ""
  28.     End With
  29.    
  30.     For R = 1 To 10
  31.         C(R) = 0
  32.         For N = 1 To 90
  33.             RN(R, N) = -1
  34.         Next N
  35.     Next R
  36.    
  37.     Set rs = New ADODB.Recordset
  38.    
  39.     rs.Open "SELECT * FROM Archivio ORDER BY Id DESC", cn, adOpenForwardOnly
  40.    
  41.     rit = 1
  42.     Do While Not rs.EOF
  43.         NS = Space$(154)
  44.         For R = 1 To 10
  45.             If C(R) < 90 Then
  46.                 For NN = 1 To 5
  47.                     v = Val(rs.Fields(RU(R) & CStr(NN)).Value)
  48.                     p = (R - 1) * 15 + (NN - 1) * 3 + 5
  49.                     If RN(R, v) = -1 Then
  50.                         RN(R, v) = v
  51.                         C(R) = C(R) + 1
  52.                         ss = Format$(v, "00")
  53.                     Else
  54.                         ss = "--"
  55.                     End If
  56.                     Mid$(NS, 1) = Format$(rit, "000")
  57.                     Mid$(NS, p) = ss
  58.                 Next NN
  59.             End If
  60.         Next R
  61.         If Mid$(NS, 5) <> Space$(150) Then
  62.             List1.AddItem NS
  63.             rit = rit + 1
  64.         End If
  65.        
  66.         rs.MoveNext
  67.     Loop
  68.    
  69.     rs.Close
  70.    
  71.     Set rs = Nothing



... il ritardo apparira' alla sinistra ...

PM
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 21:25
Lunedì, 28/01/2008
ok funziona pefettamente come intendevo...
pero'  ho cercato di aggiungere l'1° ruota....
ed è ritornato lo stesso problemino di prima..
cioè : che  dopo il ritardo maggiore si aggiungono nella listauna infinita di righe vuote

Codice sorgente - presumibilmente VB.NET

  1. Dim rs As ADODB.Recordset
  2.     Dim RUS As String
  3.     Dim RU() As String
  4.     Dim R As Integer
  5.     Dim N As Integer
  6.     Dim RN(1 To 11, 1 To 90)
  7.     Dim C(1 To 11)
  8.     Dim NN As Integer
  9.     Dim NS As String * 168
  10.     Dim v As Integer
  11.     Dim p As Integer
  12.     Dim ss As String * 2
  13.     Dim rit As Integer
  14.      
  15.     RUS = "--*BA*CA*FI*GE*MI*NA*PA*RO*To*VE*NZ*"
  16.     RU = Split(RUS, "*")
  17.  
  18.     With List1
  19.         .Font.Name = "Terminal"
  20.         .Font.Size = 9
  21.         .Clear
  22.         NS = "RIT " & Space$(168)
  23.         For R = 1 To 11
  24.             Mid$(NS, (R - 1) * 15 + 5) = "----- " & RU(R) & " ----- "
  25.         Next R
  26.         .AddItem NS
  27.         .AddItem ""
  28.     End With
  29.      
  30.     For R = 1 To 11
  31.         C(R) = 0
  32.         For N = 1 To 90
  33.             RN(R, N) = -1
  34.         Next N
  35.     Next R
  36.      
  37.     Set rs = New ADODB.Recordset
  38.      
  39.     rs.Open "Select * FROM Archivio ORDER BY Id DESC", cn, adOpenForwardOnly
  40.      
  41.     rit = 0
  42.     Do While Not rs.EOF
  43.         NS = Space$(168)
  44.         For R = 1 To 11
  45.             If C(R) < 90 Then
  46.                 For NN = 1 To 5
  47.                     v = Val(rs.Fields(RU(R) & CStr(NN)).Value)
  48.                     p = (R - 1) * 15 + (NN - 1) * 3 + 5
  49.                      
  50.                     If RN(R, v) = -1 Then
  51.                         RN(R, v) = v
  52.                         C(R) = C(R) + 1
  53.                         ss = Format$(v, "00")
  54.                     Else
  55.                         ss = "--"
  56.                     End If
  57.                     Mid$(NS, 1) = Format$(rit, "000")
  58.                     Mid$(NS, p) = ss
  59.                 Next NN
  60.             End If
  61.         Next R
  62.         If Mid$(NS, 5) <> Space$(168) Then
  63.             List1.AddItem NS
  64.             rit = rit + 1
  65.         End If
  66.          
  67.         rs.MoveNext
  68.     Loop
  69.      
  70.     rs.Close
  71.      
  72.     Set rs = Nothing


queste sono le  modifiche che ho fatto
che che  il problema sia nello SPACE

PM
Avatar
gantonio (Normal User)
Guru^2


Messaggi: 1532
Iscritto: 09/09/2007

Segnala al moderatore
Postato alle 23:09
Lunedì, 28/01/2008
Questo il codice corretto

Codice sorgente - presumibilmente VB.NET

  1. Dim rs As ADODB.Recordset
  2.     Dim RUS As String
  3.     Dim RU() As String
  4.     Dim R As Integer
  5.     Dim N As Integer
  6.     Dim RN(1 To 11, 1 To 90)
  7.     Dim C(1 To 11)
  8.     Dim NN As Integer
  9.     Dim NS As String * 168
  10.     Dim v As Integer
  11.     Dim p As Integer
  12.     Dim ss As String * 2
  13.     Dim rit As Integer
  14.    
  15.     RUS = "--*BA*CA*FI*GE*MI*NA*PA*RO*TO*VE*NZ*"
  16.     RU = Split(RUS, "*")
  17.  
  18.     With List1
  19.         .Font.Name = "Terminal"
  20.         .Font.Size = 9
  21.         .Clear
  22.         NS = "RIT " & Space$(165)
  23.         For R = 1 To 11
  24.             Mid$(NS, (R - 1) * 15 + 5) = "----- " & RU(R) & " ----- "
  25.         Next R
  26.         .AddItem NS
  27.         .AddItem ""
  28.     End With
  29.    
  30.     For R = 1 To 11
  31.         C(R) = 0
  32.         For N = 1 To 90
  33.             RN(R, N) = -1
  34.         Next N
  35.     Next R
  36.    
  37.     Set rs = New ADODB.Recordset
  38.    
  39.     rs.Open "SELECT * FROM Archivio ORDER BY Id DESC", cn, adOpenForwardOnly
  40.    
  41.     rit = 0
  42.     Do While Not rs.EOF
  43.         NS = Space$(168)
  44.         For R = 1 To 11
  45.             If C(R) < 90 Then
  46.                 For NN = 1 To 5
  47.                     v = Val(rs.Fields(RU(R) & CStr(NN)).Value)
  48.                     p = (R - 1) * 15 + (NN - 1) * 3 + 5
  49.                    
  50.                     If RN(R, v) = -1 Then
  51.                         RN(R, v) = v
  52.                         C(R) = C(R) + 1
  53.                         ss = Format$(v, "00")
  54.                     Else
  55.                         ss = "--"
  56.                     End If
  57.                    
  58.                     Mid$(NS, 1) = Format$(rit, "000")
  59.                     Mid$(NS, p) = ss
  60.                 Next NN
  61.             End If
  62.         Next R
  63.         If Len(Trim(NS)) Then
  64.             List1.AddItem NS
  65.             rit = rit + 1
  66.         End If
  67.        
  68.         rs.MoveNext
  69.     Loop
  70.    
  71.     rs.Close
  72.    
  73.     Set rs = Nothing


PM
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 23:10
Lunedì, 28/01/2008
ok  ho appena risolto

PM
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 23:12
Lunedì, 28/01/2008
provo anche quello

PM
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 23:18
Lunedì, 28/01/2008
si avevo fatto le stesse modifico
ho aggiunto + 14 allo space

qwowww



che bello


adesso studio come  mettere tutto in MSHFlexgrid


PM
Avatar
magicolotto (Normal User)
Expert


Messaggi: 338
Iscritto: 21/01/2008

Segnala al moderatore
Postato alle 13:52
Martedì, 29/01/2008
Codice sorgente - presumibilmente Visual Basic 6

  1. Private Sub popolaflex_Click()
  2. MSHFlexGrid1.TextMatrix(0, 0) = "Rit"
  3. MSHFlexGrid1.TextMatrix(0, 1) = "ba"
  4. MSHFlexGrid1.TextMatrix(0, 2) = "ba"
  5. MSHFlexGrid1.TextMatrix(0, 3) = "ba"
  6. MSHFlexGrid1.TextMatrix(0, 4) = "ba"
  7. MSHFlexGrid1.TextMatrix(0, 5) = "ba"
  8.  
  9. MSHFlexGrid1.TextMatrix(0, 6) = "ca"
  10. MSHFlexGrid1.TextMatrix(0, 7) = "ca"
  11. MSHFlexGrid1.TextMatrix(0, 8) = "ca"
  12. MSHFlexGrid1.TextMatrix(0, 9) = "ca"
  13. MSHFlexGrid1.TextMatrix(0, 10) = "ca"
  14.  
  15. MSHFlexGrid1.TextMatrix(0, 11) = "fi"
  16. MSHFlexGrid1.TextMatrix(0, 12) = "fi"
  17. MSHFlexGrid1.TextMatrix(0, 13) = "fi"
  18. MSHFlexGrid1.TextMatrix(0, 14) = "fi"
  19. MSHFlexGrid1.TextMatrix(0, 15) = "fi"
  20.  
  21. MSHFlexGrid1.TextMatrix(0, 16) = "ge"
  22. MSHFlexGrid1.TextMatrix(0, 17) = "ge"
  23. MSHFlexGrid1.TextMatrix(0, 18) = "ge"
  24. MSHFlexGrid1.TextMatrix(0, 19) = "ge"
  25. MSHFlexGrid1.TextMatrix(0, 20) = "ge"
  26.  
  27. MSHFlexGrid1.TextMatrix(0, 21) = "mi"
  28. MSHFlexGrid1.TextMatrix(0, 22) = "mi"
  29. MSHFlexGrid1.TextMatrix(0, 23) = "mi"
  30. MSHFlexGrid1.TextMatrix(0, 24) = "mi"
  31. MSHFlexGrid1.TextMatrix(0, 25) = "mi"
  32.  
  33. MSHFlexGrid1.TextMatrix(0, 26) = "na"
  34. MSHFlexGrid1.TextMatrix(0, 27) = "na"
  35. MSHFlexGrid1.TextMatrix(0, 28) = "na"
  36. MSHFlexGrid1.TextMatrix(0, 29) = "na"
  37. MSHFlexGrid1.TextMatrix(0, 30) = "na"
  38.  
  39. MSHFlexGrid1.TextMatrix(0, 31) = "pa"
  40. MSHFlexGrid1.TextMatrix(0, 32) = "pa"
  41. MSHFlexGrid1.TextMatrix(0, 33) = "pa"
  42. MSHFlexGrid1.TextMatrix(0, 34) = "pa"
  43. MSHFlexGrid1.TextMatrix(0, 35) = "pa"
  44.  
  45. MSHFlexGrid1.TextMatrix(0, 36) = "ro"
  46. MSHFlexGrid1.TextMatrix(0, 37) = "ro"
  47. MSHFlexGrid1.TextMatrix(0, 38) = "ro"
  48. MSHFlexGrid1.TextMatrix(0, 39) = "ro"
  49. MSHFlexGrid1.TextMatrix(0, 40) = "ro"
  50.  
  51. MSHFlexGrid1.TextMatrix(0, 41) = "to"
  52. MSHFlexGrid1.TextMatrix(0, 42) = "to"
  53. MSHFlexGrid1.TextMatrix(0, 43) = "to"
  54. MSHFlexGrid1.TextMatrix(0, 44) = "to"
  55. MSHFlexGrid1.TextMatrix(0, 45) = "to"
  56.  
  57.  
  58. MSHFlexGrid1.TextMatrix(0, 46) = "ve"
  59. MSHFlexGrid1.TextMatrix(0, 47) = "ve"
  60. MSHFlexGrid1.TextMatrix(0, 48) = "ve"
  61. MSHFlexGrid1.TextMatrix(0, 49) = "ve"
  62. MSHFlexGrid1.TextMatrix(0, 50) = "ve"
  63.  
  64. MSHFlexGrid1.TextMatrix(0, 51) = "nz"
  65. MSHFlexGrid1.TextMatrix(0, 52) = "nz"
  66. MSHFlexGrid1.TextMatrix(0, 53) = "nz"
  67. MSHFlexGrid1.TextMatrix(0, 54) = "nz"
  68. MSHFlexGrid1.TextMatrix(0, 55) = "nz"
  69. With MSHFlexGrid1
  70.   Dim cel As Integer
  71.   For cel = 1 To 56
  72.         .Redraw = False
  73.         ' imposta la larghezza delle colonne della griglia
  74.         .ColWidth(0) = 400
  75.         .ColWidth(cel) = 263
  76.       Next cel
  77.         .AllowBigSelection = False
  78.         .FillStyle = flexFillSingle
  79.         .Redraw = True
  80.  
  81.     End With



come da codice sopra

ho creato la struttura della griglia per l'inserimento in essa del tabellone...come sopra discusso  e finito


mi dareste un suggerimento su come inserire quel NS

grazie

PM
Pagine: [ 1 2 3 4 5 6 ] Precedente | Prossimo