Multiple choice test problems

Status
Not open for further replies.

hygor

Daemon Poster
Messages
833
I am developing a teaching application as part of an ongoing project. I have not been able to find examples of this in VB.net format, but have found a VB 6 version which I am trying to convert and modify for suitable use.

I have a number of problems:

1) below is code taken directly from a VB.6 Applic.. .Net does not like the Open command saying it is not declared

2) VB.Net seems to hate the For Input As #1 bit and states that the end of an expression is needed!

3) Therefore it also does not like the #1 after each input line

Sub LoadFromFile()
Open "data.dat" For Input As #1
Input #1, Question(1), Answer(1, 1), Answer(1, 2), Answer(1, 3), Answer(1, 4), CorrectAnswer(1)
Input #1, Question(2), Answer(2, 1), Answer(2, 2), Answer(2, 3), Answer(2, 4), CorrectAnswer(2)
Input #1, Question(3), Answer(3, 1), Answer(3, 2), Answer(3, 3), Answer(3, 4), CorrectAnswer(3)
Input #1, Question(4), Answer(4, 1), Answer(4, 2), Answer(4, 3), Answer(4, 4), CorrectAnswer(4)
If Not EOF(1) Then
Input #1, EndMessage(1), EndMessage(2), EndMessage(3), EndMessage(4)
Message = True
Else
Message = False
End If
Close #1
End Sub

4) Then in the code below it is claiming that AnswerBox does not have a default set. I have created a radiobutton that I have named AnswerBox and I want to use as the template, but It does not seem to see this as the defaults.

CurrentQ = 2
Label1.Text = Question(2)
AnswerBox(1).Text = Answer(2, 1)
AnswerBox(2).Text = Answer(2, 2)
AnswerBox(3).Text = Answer(2, 3)
AnswerBox(4).Text = Answer(2, 4)


These 4 problems are driving me insane, I seem to be going in circles and my deadline looms ever nearer! If anyone can help with any/all of these problems I would be most grateful
 
nevermind, i decided to use a database table as my source instead and that simplified things trmendously... so i have it working!
 
Status
Not open for further replies.
Back
Top Bottom