The menu strip must be created programmatically (ie NOT dragged and dropped onto the form). The exit option added to the menu strip must exit the application (This works)
A structure must be created to encapsulate all the questions and suggested answers. The structure must contain:
1.Question String
2.Answers Collection
3.Correct Answer String
When the form loads, 5 questions must be created in code using these structures. These 5 structures will then serve as the quiz. The user must be shown the first question, and have the option of browsing forwards and backwards through the quiz. The program should store saved answers to select the radio button when users cycle through. This can be done by any means possible, for example an ArrayList or SortedList.
The suggested answers must be randomized the first time the form loads only.
Once the user has selected an answer for every question, the Submit button should be enabled. When the user clicks this button, the program must then evaluate the quiz and compare the users selected answers against the correct answer. A valid message must then be displayed via a MessageBox indicating the users score.
Here is what I have done so far:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mnuMain As MainMenu = New MainMenu()
Dim exitApp As MenuItem = mnuMain.MenuItems.Add("Exit")
Me.Menu = mnuMain
For Each m As MenuItem In mnuMain.MenuItems
AddHandler m.Click, AddressOf HandleMenuItemClick
Next
End Sub
Private Sub HandleMenuItemClick(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
If (Not (TypeOf (sender) Is MenuItem)) Then
Throw New Exception("HandleMenuItemClick called incorrectly!")
End If
Dim s As MenuItem = CType(sender, MenuItem)
Application.Exit()
End Sub
End Class
Module Module1
Sub Main()
Dim question1 As Quiz = New Quiz("What is the fastest animal on the planet?", "Cheetah")
Dim question2 As Quiz = New Quiz("What is the largest animal on the planet?", "Elephant")
Dim question3 As Quiz = New Quiz("Which of these animals can survive in water and land?", "Crocodile")
Dim question4 As Quiz = New Quiz("Which one of these animals is considered to be the King of the wild?", "Lion")
Dim question5 As Quiz = New Quiz("Which one of these animals carry venom in their fangs?", "Snake")
End Sub
Public Structure Quiz
Dim question As String
Dim correctAnswer As String
Public Sub New(ByVal newQuestion As String, _
ByVal newCorrectAnswer As String)
question = newQuestion
correctAnswer = newCorrectAnswer
End Sub
End Structure
End Module
**Am I on the right track? Where should I create the 5 arrays that hold the possible answers? What should I use to make it possible for the user to cycle through the questions? Any help will be very much appreciated. **