Jump to content

Visual Basic 6.0


Recommended Posts

Dim np, min, seg As Integer
Dim respostas(1 To 5, 1 To 30) As Integer


Private Sub bd_id_change()
If Dir(App.Path & "\imagens\" & bd_id.Caption & ".jpg") = "" Then
  Imagem.Picture = LoadPicture()
Else
  Imagem.Picture = LoadPicture(App.Path & "\imagens\" & bd_id.Caption & ".jpg")
End If
End Sub


Private Sub sortearpergunta()
nps = Int(perguntas.Recordset.RecordCount * Rnd + 1)
respostas(1, np) = nps
perguntas.Recordset.AbsolutePosition = nps - 1
pergunta.Caption = bd_pergunta.Caption
Do
  prc = Int(Rnd * 3) + 1
  pre1 = Int(Rnd * 3) + 1
  pre2 = Int(Rnd * 3) + 1
Loop Until prc <> pre1 And prc <> pre2 And pre1 <> pre2
respostas(2, np) = prc
respostas(3, np) = pre1
respostas(4, np) = pre2
resposta(prc).Caption = bd_respostacerta.Caption
resposta(pre1).Caption = bd_respostaerrada1.Caption
resposta(pre2).Caption = bd_respostaerrada2.Caption
Form1.Caption = "Pergunta " & np & " de 30"
End Sub



Private Sub crono_Timer()
seg = seg - 1
If seg < 0 Then
  seg = 59
  min = min - 1
End If
tempo.Caption = min & ":" & seg
If min < 0 & seg < 0 Then
  termi_Click
  End If
End Sub

Private Sub Form_Load()
min = 30
seg = 0
Randomize
np = 1
Form1.Caption = "Pergunta " & np & " de 30"
perguntas.DatabaseName = App.Path & "\BD\perguntas 2003.mdb"
perguntas.RecordSource = "perguntas"
End Sub


Private Sub pa_Click()
np = np - 1
If np = 1 Then pa.Enabled = False
Form1.Caption = "Pergunta " & np & " de 30"
perguntas.Recordset.AbsolutePosition = respostas(1, np) - 1
pergunta.Caption = bd_pergunta.Caption
resposta(respostas(2, np)).Caption = bd_respostacerta.Caption
resposta(respostas(3, np)).Caption = bd_respostaerrada1.Caption
resposta(respostas(4, np)).Caption = bd_respostaerrada2.Caption
resposta(1).BackColor = &H80000005
resposta(2).BackColor = &H80000005
resposta(3).BackColor = &H80000005
If respostas(5, np) <> 0 Then resposta(respostas(5, np)).BackColor = &HFFFF&
End Sub


Private Sub ps_Click()
pa.Enabled = True
resposta(1).BackColor = &H80000005
resposta(2).BackColor = &H80000005
resposta(3).BackColor = &H80000005
np = np + 1
Form1.Caption = "Pergunta " & np & " de 30"
If respostas(1, np) = 0 Then
  sortearpergunta
Else
  perguntas.Recordset.AbsolutePosition = respostas(1, np) - 1
  pergunta.Caption = bd_pergunta.Caption
  resposta(respostas(2, np)).Caption = bd_respostacerta.Caption
  resposta(respostas(3, np)).Caption = bd_respostaerrada1.Caption
  resposta(respostas(4, np)).Caption = bd_respostaerrada2.Caption
  If respostas(5, np) <> 0 Then resposta(respostas(5, np)).BackColor = &HFFFF&
End If
End Sub


Private Sub resposta_Click(Index As Integer)
resposta(1).BackColor = &H80000005
resposta(2).BackColor = &H80000005
resposta(3).BackColor = &H80000005
resposta(Index).BackColor = &HFFFF&
respostas(5, np) = Index
End Sub


Private Sub termi_Click()

For i = 5 To 30
MsgBox (i)
Next i
If respostas(5, np) = 0 Then
MsgBox (ola)
End If
Form2.Show
Unload Form1
End Sub


Private Sub Timer1_Timer()
Timer1.Enabled = False
perguntas.Recordset.MoveLast
perguntas.Recordset.MoveFirst
sortearpergunta
End Sub

preenche-lo? como assim?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.