Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 12 su 12
  1. #11
    codice:
    Private Sub Command1_Click()
    Randomize
        Dim i As Integer
        Dim LB As Integer
        Dim UB As Integer
        MINIMO = 1
        MASSIMO = 5
       Text1.Text = Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO)
       Text2.Text = Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO)
       Text3.Text = Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO)
    If Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
    Label1.Caption = "VITTORIA!!"
    End If
    If Not Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
    Label1.Caption = "Ritenta!"
    End If
    a = Text4
    If Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
    Text4.Text = a + 15
    End If
    a = Text4
    If Not Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
    Text4.Text = a - 1
    End If
    If Text4.Text = 0 Then
    Label1.Caption = "Game Over"
    End If
     End Sub
    allora vi rispigo questo codice qui funziona....quando clikko cmd1 mi genera 3 num casuali su 3 text box.....ok...io devo aggiungere un cmd "STOP"....quando clikko CMD1 avvio l'animazione dei numeri e quando vado su STOP me li ferma...ok??grazie

  2. #12
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,481
    Nel codice ci sono degli errori (alcuni bloccanti ...).

    Comunque, ho messo un po' di ordine ... leggi questo esempio

    codice:
    Option Explicit
    
    Private Const MINIMO As Integer = 1
    Private Const MASSIMO As Integer = 5
    
    Private bContinue As Boolean
    
    Private Sub Command1_Click()
        Dim i As Integer
        Dim a As Integer
       
        Randomize Timer
        
        bContinue = True
        
        Do While bContinue
            Text1.Text = CStr(Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO))
            Text2.Text = CStr(Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO))
            Text3.Text = CStr(Int((MASSIMO - MINIMO + 1) * Rnd + MINIMO))
            
            If Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
                Label1.Caption = "VITTORIA!!"
            End If
            
            If Not Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
                Label1.Caption = "Ritenta!"
            End If
            
            a = Val(Text4.Text)
            If Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
                Text4.Text = CStr(a + 15)
            End If
            
            a = Val(Text4.Text)
            If Not Text1.Text = Text2.Text And Text2.Text = Text3.Text Then
                Text4.Text = CStr(a - 1)
            End If
            
            If Val(Text4.Text) = 0 Then
                Label1.Caption = "Game Over"
            End If
            
            DoEvents
        Loop
    End Sub
    
    Private Sub Command2_Click()
        bContinue = False
    End Sub
    Non ho modificato il tuo "algoritmo", non sapendo cosa vuoi ottenere ...

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 © 2026 vBulletin Solutions, Inc. All rights reserved.