So in my class we are working with Arrays this week. We have to create a driver license exam program. It has to use multiple forms. First form the user inputs the answers then once he clicks the score button a new form pop's up stating the correct answers and how many he got correct. Now I created the program but have come across 2 problems.

FIRST:

Private strCorrect As String=("B", "D", "A", "A", "C", "A", "B", "A", "C", "D", "B", "C", "D", "A", "D", "C", "C", "B", "D", "A")

I get a error at the fist comma after "B" it wants me to replace the comma with a ) but then that would make the array not work.

SECOND:

Private Sub btnScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScore.Click
        Dim Secound As New frmanswers

        frmanswers.Show()

        Dim intcount As Integer

        strUser(0) = cbo1.SelectedItem
        strUser(1) = cbo2.SelectedItem
        strUser(2) = cbo3.SelectedItem
        strUser(3) = cbo4.SelectedItem
        strUser(4) = cbo5.SelectedItem
        strUser(5) = cbo6.SelectedItem
        strUser(6) = cbo7.SelectedItem
        strUser(7) = cbo8.SelectedItem
        strUser(8) = cbo9.SelectedItem
        strUser(9) = cbo10.SelectedItem
        strUser(10) = cbo11.SelectedItem
        strUser(11) = cbo12.SelectedItem
        strUser(12) = cbo13.SelectedItem
        strUser(13) = cbo14.SelectedItem
        strUser(14) = cbo15.SelectedItem
        strUser(15) = cbo16.SelectedItem
        strUser(16) = cbo17.SelectedItem
        strUser(17) = cbo18.SelectedItem
        strUser(18) = cbo19.SelectedItem
        strUser(19) = cbo20.SelectedItem

        For x = 1 To 19
            If strCorrect(x) = strUser(x) Then
                intcount += 1
            End If
        Next
    End Sub

How do i get the answers from the user to transfer over to the other form where i have to display how many correct answers the user got correct?(hopefully the question does not confuse you)
I need the results of the loop to transfer over the the other form where the results is displayed onto a label. I will reply to the thread with the full code of the program that I have.

First form:

Public Class Main


    Private strCorrect As String=("B", "D", "A", "A", "C", "A", "B", "A", "C", "D", "B", "C", "D", "A", "D", "C", "C", "B", "D", "A")
    Private strUser(19) As String

    Private Sub btnScore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScore.Click
        Dim Secound As New frmanswers

        frmanswers.Show()

        Dim intcount As Integer

        strUser(0) = cbo1.SelectedItem
        strUser(1) = cbo2.SelectedItem
        strUser(2) = cbo3.SelectedItem
        strUser(3) = cbo4.SelectedItem
        strUser(4) = cbo5.SelectedItem
        strUser(5) = cbo6.SelectedItem
        strUser(6) = cbo7.SelectedItem
        strUser(7) = cbo8.SelectedItem
        strUser(8) = cbo9.SelectedItem
        strUser(9) = cbo10.SelectedItem
        strUser(10) = cbo11.SelectedItem
        strUser(11) = cbo12.SelectedItem
        strUser(12) = cbo13.SelectedItem
        strUser(13) = cbo14.SelectedItem
        strUser(14) = cbo15.SelectedItem
        strUser(15) = cbo16.SelectedItem
        strUser(16) = cbo17.SelectedItem
        strUser(17) = cbo18.SelectedItem
        strUser(18) = cbo19.SelectedItem
        strUser(19) = cbo20.SelectedItem

        For x = 1 To 19
            If strCorrect(x) = strUser(x) Then
                intcount += 1
            End If
        Next
    End Sub

End Class

Second Form:

Public Class frmanswers

    Private Sub Secound_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        lblAnswers.Text=

    End Sub

  
End Class

End Class

OK so I figured out my first problem I have to use { instead of ) :( feel kinda dumb now. But still need help on my second problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.