who wants to be millioniare VB

Jeff1evesquePtownerNH
Jeff1evesquePtownerNH used Ask the Experts™
on
Hi i want to make a program game 'who wants to be a millioniare' I am going to have 25 questions and everytime you answer one question right a invisible shape box will be visible. I am really new with this, can you show me how to do the coding for the 1st or couple questions.

This is what i have done so far, not much:

 Option Explicit

Private Sub cmdbegin_Click()
cmdbegin.Visible = False
cmdbegin.Enabled = False
cmd1.Visible = True
cmd2.Visible = True
cmd3.Visible = True
cmd4.Visible = True
lblq.Visible = True
End Sub

Private Sub cmdend_Click()
End
End Sub

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This should get you started:

enum enmAnswer
   eeAnswerA
   eeAnswerB
   eeAnswerC
   eeAnswerD
end enum
Type typQuestion
  Question as string
  AnswerA as string
  AnswerB as string
  AnswerC as string
  AnswerD as string
  CorrectAnswer as enmAnswer
end type

dim m_aQuestions(1 to 10) as typQuestion
dim tCurrentQuestion as typQuestion

private sub form_load
  dim tQuestion as typQuestion
  tQuestion.Question = "Who wants to be a millionaire"
  tQuestion.AnswerA = "I DO...I DO"
  tQuestion.AnswerB = "Give it to somebody else"
  tQuestion.AnswerC = "Gandhi"
  tQuestion.AnswerD = "Nobody"
  tQuestion.CorrectAnswer = AnswerA
  m_aQuestions(1)= tQuestion

  tQuestion.Question = "What according to Douglas Adams is the meaning of life"
  tQuestion.AnswerA = "Eating pies"
  tQuestion.AnswerB = "42"
  tQuestion.AnswerC = "Love"
  tQuestion.AnswerD = "Happiness"
  tQuestion.CorrectAnswer = AnswerB
  m_aQuestions(2)= tQuestion
...
You could also load the questions from disk, but you should crawl before you walk.

end sub

Private Sub cmdbegin_Click()
dim tQuestion as typQuestion
lQuestionNum = lQuestionNum +1
if lQuestionNum > ubound(m_aQuestions) then
   msgbox "Game over"
   exit sub
endif
tCurrentQuestion = m_aQuestions(lQuestionNum)

Text1.text = tQuestion.Question

cmd1.caption = tQuestion.AnswerA
cmd2.caption = tQuestion.AnswerB
cmd3.caption = tQuestion.AnswerC
cmd4.caption = tQuestion.AnswerD
cmd1.visible = true
cmd2.visible = true
cmd3.visible = true
cmd4.visible = true
cmdbegin.visible = false
End Sub

private sub cmd1_Click
cmd1.visible = False
cmd2.visible = False
cmd3.visible = False
cmd4.visible = False
cmdbegin.visible = True
if tCurrentQuestion.correctAnswer = eeAnswerA then
   msgbox "Correct"
else
   msgbox "Incorrect"
endif
end sub

private sub cmd2_Click
cmd1.visible = False
cmd2.visible = False
cmd3.visible = False
cmd4.visible = False
cmdbegin.visible = True
if tCurrentQuestion.correctAnswer = eeAnswerB then
   msgbox "Correct"
else
   msgbox "Incorrect"
endif
end sub
private sub cmd3_Click
cmd1.visible = False
cmd2.visible = False
cmd3.visible = False
cmd4.visible = False
cmdbegin.visible = True
if tCurrentQuestion.correctAnswer = eeAnswerC then
   msgbox "Correct"
else
   msgbox "Incorrect"
endif
end sub
private sub cmd4_Click
cmd1.visible = False
cmd2.visible = False
cmd3.visible = False
cmd4.visible = False
cmdbegin.visible = True
if tCurrentQuestion.correctAnswer = eeAnswerD then
   msgbox "Correct"
else
   msgbox "Incorrect"
endif
end sub

Private Sub cmdend_Click()
End
End Sub
Thanks alot.. this should definetly get me started.. This is my mid-terms for visual basics class

thanks :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial