VB motus

perloutta Messages postés 65 Statut Membre -  
lermite222 Messages postés 9042 Statut Contributeur -
Bonjour,
comment je peux en VB sous le meme bouton accéder a différent bloc du code.je m'explique par exemple en motus sous le bouton vérifier je dois verifier si le mot est juste ou pas mai chaque appel sera executé ds une ligne
mais chaque fois il commence dés le début...
Configuration: Windows Vista
Opera 9.60

6 réponses

  1. lermite222 Messages postés 9042 Statut Contributeur 1 199
     
    Bonjour,
    VB Motus ?? c'est quoi, connais pas ! (ont peu pas tout connaître)
    Mais si je comprend ta demande tu doit séparer ton code en sub ou en fonction et appeller la sub / Fonction qui traite le sujet !
    Ou bien mettre des conditions qui sérierons les test à effectuer.
    A+
    0
  2. perloutta Messages postés 65 Statut Membre
     
    je suis entrain de developper le jeu motus su VB.Net 2003 sous un meme bouton comment je peux acceder chaque fois a un bloc sans executer le precedent
    0
  3. lermite222 Messages postés 9042 Statut Contributeur 1 199
     
    Si c'est avec un seul bouton tu doit avoir des conditions différentes, par exemple (je connais pas ton jeu) si il y à 4 joueurs et que c'est le 2ème qui vient de jouer mettre une condition que si joueuractif=2 c'est au tour du joueur3 de jouer.. etc.
    Mais c'est difficile de te donner plus d'explication sans rien savoir, peut-tu mettre le code qui est appeller par ton bouton et un peu expliquer ?
    0
  4. perloutta Messages postés 65 Statut Membre
     
    ok :)
    0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. perloutta Messages postés 65 Statut Membre
     
    Private Sub verifierbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles verifierbtn.Click
    Dim i, j As Integer
    'i = motValide(p1, p2, p3, p4, p5, p6, p7, mot, DataGrid2) (vérification si le mot entré existe dans le dictionnaire (base de donnée)mnt je désactive la verification pour pouvoir tester aisement
    'If i = 0 Then

    copie(p1, p2, p3, p4, p5, p6, p7, TextBox1, TextBox20, TextBox19, TextBox18, TextBox17, TextBox16, TextBox15)
    Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox1, TextBox20, TextBox19, TextBox18, TextBox17, TextBox16, TextBox15, Lab, mot)
    clear(p1, p2, p3, p4, p5, p6, p7)
    j = String.Compare(Lab.Text, mot.Text) 'comparer le mot tapé par le joueur et le mot correct

    If j <> 0 Then ' s'il n'est pas juste alors passer à la ligne suivante

    ProgressBar1.Value = 0
    Timer1.Enabled = True
    If p1.Text <> "" And p2.Text <> "" And p3.Text <> "" And p4.Text <> "" And p5.Text <> "" And p6.Text <> "" And p7.Text <> "" Then
    copie(p1, p2, p3, p4, p5, p6, p7, TextBox23, TextBox22, TextBox21, TextBox28, TextBox25, TextBox5, TextBox12) 'copie du mot tapé dans la grille
    Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox23, TextBox22, TextBox21, TextBox28, TextBox25, TextBox5, TextBox12, Lab, mot)
    clear(p1, p2, p3, p4, p5, p6, p7)
    End If
    j = String.Compare(Lab.Text, mot.Text)
    Else
    MsgBox("bravo") ' c'est gagner pas de passage a la ligne suivante
    Exit Sub
    End If

    If j <> 0 Then

    ProgressBar1.Value = 0
    Timer1.Enabled = True
    If p1.Text <> "" And p2.Text <> "" And p3.Text <> "" And p4.Text <> "" And p5.Text <> "" And p6.Text <> "" And p7.Text <> "" Then
    copie(p1, p2, p3, p4, p5, p6, p7, TextBox35, TextBox49, TextBox46, TextBox52, TextBox24, TextBox4, TextBox9)
    Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox35, TextBox49, TextBox46, TextBox52, TextBox24, TextBox4, TextBox9, Lab, mot)
    clear(p1, p2, p3, p4, p5, p6, p7)
    End If
    Else : MsgBox("bravo")
    Exit Sub
    End If

    'Else : Exit Sub
    'End If

    clear(p1, p2, p3, p4, p5, p6, p7)
    End Sub
    0
  7. lermite222 Messages postés 9042 Statut Contributeur 1 199
     
    Pas sûr, mais je pense que j'ai saisi ce que tu veux dire..
    Private Sub verifierbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles verifierbtn.Click
        Dim i, j, m As Integer
        i = motValide(p1, p2, p3, p4, p5, p6, p7, mot, DataGrid2) ' (vérification si le mot entré existe dans le dictionnaire (base de donnée)mnt je désactive la verification pour pouvoir tester aisement 
        If i = 0 Then
    
            copie(p1, p2, p3, p4, p5, p6, p7, TextBox1, TextBox20, TextBox19, TextBox18, TextBox17, TextBox16, TextBox15)
            Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox1, TextBox20, TextBox19, TextBox18, TextBox17, TextBox16, TextBox15, Lab, mot)
            clear(p1, p2, p3, p4, p5, p6, p7)
            j = String.Compare(Lab.Text, mot.Text) 'comparer le mot tapé par le joueur et le mot correct 
    
            If j <> 0 Then ' s'il n'est pas juste alors passer à la ligne suivante 
                ProgressBar1.Value = 0
                Timer1.Enabled = True
                If p1.Text <> "" And p2.Text <> "" And p3.Text <> "" And p4.Text <> "" And p5.Text <> "" And p6.Text <> "" And p7.Text <> "" Then
                    copie(p1, p2, p3, p4, p5, p6, p7, TextBox23, TextBox22, TextBox21, TextBox28, TextBox25, TextBox5, TextBox12) 'copie du mot tapé dans la grille 
                    Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox23, TextBox22, TextBox21, TextBox28, TextBox25, TextBox5, TextBox12, Lab, mot)
                    clear(p1, p2, p3, p4, p5, p6, p7)
                End If
                m = String.Compare(Lab.Text, mot.Text)
            Else
                MsgBox("bravo") ' c'est gagner pas de passage a la ligne suivante 
                Exit Sub
            End If
    
    
            If m <> 0 Then
                ProgressBar1.Value = 0
                Timer1.Enabled = True
                If p1.Text <> "" And p2.Text <> "" And p3.Text <> "" And p4.Text <> "" And p5.Text <> "" And p6.Text <> "" And p7.Text <> "" Then
                    copie(p1, p2, p3, p4, p5, p6, p7, TextBox35, TextBox49, TextBox46, TextBox52, TextBox24, TextBox4, TextBox9)
                    Recherche(p1, p2, p3, p4, p5, p6, p7, TextBox35, TextBox49, TextBox46, TextBox52, TextBox24, TextBox4, TextBox9, Lab, mot)
                    clear(p1, p2, p3, p4, p5, p6, p7)
                End If
            Else : MsgBox("bravo")
                Exit Sub
            End If
        End If
    
        clear(p1, p2, p3, p4, p5, p6, p7)
    End Sub


    Remplacer le 2èm j par m
    0