Hello everybody, hope you're all good.

I'm making a quiz and I've got a set of questions and answers being loading into two different arrays, the idea is to answer a question with a choice of 4 buttons, so on a button click the answers checks to see if it is correct and moves along to the next question (while doing this the questions and answers change)

However, my problem is that i've set up an audio player as the questions are for example "what is the sound?" and there is a preview button which uses the audio player to play the sound for the user.

Now everything moves with the array however, the sound still remains the same on every question after the quesiotn has been answered. So my set of answers move (when debugging, the sound array does move but the player doesn't seem to want to) with the array and i need the player to change to the specific array position which it is in as well.

If someone could help me with this I would be forever thankful as this is getting very frustrating! hehe. Please, please help if you can as this is pretty urgent :)

Audio Player:

Dim answer = CorAnsList(qNum).sound
    Dim answerPrev As String = My.Computer.FileSystem.CurrentDirectory & "\sounds\" & answer & ".wav"

    Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPre.Click
        Dim player = New Media.SoundPlayer(answerPrev)
        player.Play()
        player.Dispose()
    End Sub

Answer button:

If qNum < 9 Then
            qNum += 1
            answer = CorAnsList(qNum).sound
            btnAns1.Text = AnswersList(qNum).answer1
            btnAns2.Text = AnswersList(qNum).answer2
            btnAns3.Text = AnswersList(qNum).answer3
            btnAns4.Text = AnswersList(qNum).answer4
        End If

no problem, all fixed now :)

Solution:

If qNum < 9 Then
            qNum += 1
            answer = CorAnsList(qNum).sound
            answerPrev = My.Computer.FileSystem.CurrentDirectory & "\sounds\" & answer & ".wav"
            btnAns1.Text = AnswersList(qNum).answer1
            btnAns2.Text = AnswersList(qNum).answer2
            btnAns3.Text = AnswersList(qNum).answer3
            btnAns4.Text = AnswersList(qNum).answer4
        End If
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.