View Single Post
Old 03-12-2015, 02:14 AM
alien8k alien8k is offline
Join Date: Mar 2015
Posts: 3
Default Streamreader - random lines (quiz)

First i want apologize for my english and i hope u will undestand me.
I need create testing (quiz) software. (question and 3 answers)
I have this code now:
// My txt file with questions and asnwers:
// rightanswer1-3: here is a, b or c, its tell to progam which answer is right. I will create condition with radio button, its no problem i know how to do this

Dim soubor As New IO.StreamReader("database.txt") 
While Not soubor.EndOfStream
Dim txtline() as string = soubor.readline().split("|") 'split line to aray of string by |
Dim question As string = txtline(0)
Dim answer1 As string = txtline(1)
Dim answer2 As String = txtline(2)
Dim answer3 As String = txtline(3)
Dim rightanswer As String = txtline(4)
End While
// Labels
label1.Text = question 
label2.Text = answer1
label3.Text = answer2
label4.Text = answer3
I have menu FORM and there is start button. I need to help with code of this button. After click -> open new form and generate random question from txt file, i dont know how to do it.)
And at this new form with generated question and answers.. i need next button which generate again new random question and answers to labels.

Thanks for help.
Reply With Quote