Jump to content


lsfranc

Member Since 05/09/2008
Offline Last Active 30/11/2008, 12:55
-----

Topics I've Started

Vb 6 - Como Parar O Codigo?

05/09/2008, 11:43

Alguem sabe como parar o codigo no VB ? Sei que a funçao stop para o programa mesmo. É que estou com um problema:

Private Sub CommandButton2_Click()
End
End Sub

Private Sub Frame1_Click()

End Sub

Private Sub opt_4_Click()

End Sub

Private Sub pergunta_seguinte_Click()

If lbl_numero.Caption = 1 Then
If opt_3.Value Then
MsgBox ("certo")
'Mostra no numero da pergunta!
lbl_numero.Caption = lbl_numero.Caption + 1
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)
opt_1.Value = False
opt_2.Value = False
opt_3.Value = False
opt_4.Value = False
End If
Else
MsgBox ("errado")
'Mostra no numero da pergunta!
'lbl_numero.Caption = lbl_numero.Caption
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)

End If



If lbl_numero.Caption = 2 Then
If opt_2.Value Then
MsgBox ("certo")
'Mostra no numero da pergunta!
lbl_numero.Caption = lbl_numero.Caption + 1
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)
opt_1.Value = False
opt_2.Value = False
opt_3.Value = False
opt_4.Value = False
End If

End If

If lbl_numero.Caption = 3 Then
If opt_3.Value Then
MsgBox ("certo")
Else
MsgBox ("errado")
'Mostra no numero da pergunta!
'lbl_numero.Caption = lbl_numero.Caption
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)

End If

End If
If lbl_numero.Caption = 4 Then
If opt_4.Value Then
MsgBox ("certo")
Else
MsgBox ("errado")
'Mostra no numero da pergunta!
'lbl_numero.Caption = lbl_numero.Caption
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)

End If
End If
If lbl_numero.Caption = 5 Then
If opt_4.Value Then
MsgBox ("certo")
Else
MsgBox ("errado")
'Mostra no numero da pergunta!
'lbl_numero.Caption = lbl_numero.Caption
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)

End If
End If

If lbl_numero.Caption = 6 Then
If opt_3.Value Then
MsgBox ("certo")
Else
MsgBox ("errado")
'Mostra no numero da pergunta!
'lbl_numero.Caption = lbl_numero.Caption
x = lbl_numero.Caption
'Mostrar a descricao da pergunta!'
lbl_pergunta.Caption = Sheets(5).Cells(x, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(x, 2))
'mostrar As Respostas
opt_1.Caption = Sheets(6).Cells(x, 1)
opt_2.Caption = Sheets(6).Cells(x, 2)
opt_3.Caption = Sheets(6).Cells(x, 3)
opt_4.Caption = Sheets(6).Cells(x, 4)

End If
End If


''If opt_1.Value = False And opt_2.Value = False And opt_3.Value = False And opt_4.Value = False Then
''MsgBox ("Tem de escolher uma resposta! O jogo vai fechar.")
''End
''End If


If lbl_numero.Caption >= 6 Then
MsgBox "Esta é a última pergunta !"
pergunta_seguinte.Enabled = False
End If

End Sub

Private Sub UserForm_Initialize()
'Mostra no numero da pergunta!
lbl_numero.Caption = 1
'Mostrar a descricao da pergunta!
lbl_pergunta.Caption = Sheets(5).Cells(1, 1)
'mostra a imagem
img_pergunta.Picture = LoadPicture(Workbooks(1).Path & "\tecnologia\" & Cells(1, 2))
'mostrar as Respostas!
opt_1.Caption = Sheets(6).Cells(1, 1)
opt_2.Caption = Sheets(6).Cells(1, 2)
opt_3.Caption = Sheets(6).Cells(1, 3)
opt_4.Caption = Sheets(6).Cells(1, 4)

End Sub


...na primeira pergunta quando respondo errado nao aparece a msgbox a dizer "errado" mas se respondo certo esta tudo bem. Na 2a pergunta se respondo certo aparece errado -> certo -> errado, ou seja, surgem em cadeia. Como posso travar isto ?

cumps

Vb 6 Jogo Das Perguntas

05/09/2008, 11:24

remover topico sff

IPB Skin By Virteq