Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt
Quiz software - Random question from txt Quiz software - Random question from txt
Quiz software - Random question from txt
Go Back  Xtreme Visual Basic Talk > > > Quiz software - Random question from txt


Reply
 
Thread Tools Display Modes
  #1  
Old 04-13-2015, 09:15 AM
alien8k alien8k is offline
Newcomer
 
Join Date: Mar 2015
Posts: 3
Default Quiz software - Random question from txt


Hello,
I would like ask you for help with me school project.
I need create quiz: I have menu form with some welcome screen and start button, which show next form.
At this form are labels for questions and answers, 3 radio button, and one button. This one button is really PROBLEM for me.
I have txt with 50questions and i need choise random 10questions every time when i start quiz. I need help with code.
At this button must be some condition for right answer (using a,b or c from Txtfile) and if is checked right radio button (with right answer) then x=+1, if checked wrong radio button, then x= +0.(I think this code i can create, but i need help with generating new questions and end quiz after 10question.)
Next function of this button must be generate next random question from Txtfile. And After 10 Question show new Form where will be value X, which is number of right answers.
My text file:
Code:
//Question|Answer1|Answer2|Answer3|right answer(a,b,c)

Question 1?|Answer1|Answer2|RightAnswer3|c
Question 2?|continue|vfvfvfvfv|gtgtgtgg|a
Question 3?|njmbnmb|right answer|right!|b
Question 4?|wasdw|cdcdc|right!|c
Question 5?|good!|fefefef|frfrfrfrf|a
I have some code, but is full of wrongs and i need help with edit:

http://oi60.tinypic.com/20pbtjo.jpg (Screen with code and error.)
Code:
Public Class Form2

    Dim q1(10), a1(10), a2(10), a3(10), ca(10) As String ' load questions , answers & correct answer
    Dim value As Integer
    Dim x As Integer 'result

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim soubor As New IO.StreamReader("textfile1.txt")
        While Not soubor.EndOfStream
            Dim txtline() As String = soubor.ReadLine().Split("|")
            Dim question As String = txtline(0)
            Dim ans1 As String = txtline(1)
            Dim ans2 As String = txtline(2)
            Dim ans3 As String = txtline(3)
            Dim rightanswer As String = txtline(4)
        End While

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim selectedanswer As String = ""

        If RadioButton1.Checked = True Then selectedanswer = "a"
        If RadioButton2.Checked = True Then selectedanswer = "b"
        If RadioButton3.Checked = True Then selectedanswer = "c"

        If selectedanswer = ca(value) Then x = x + 1
        loadquestions()
    End Sub

    Public Sub loadquestions()


        ' Initialize the random-number generator.
        Randomize()
        ' Generate random value between 1 and 10. 
        value = CInt(Int((10 * Rnd()) + 1))
        Label1.Text = q1(value).ToString
        Label2.Text = a1(value).ToString
        Label3.Text = a2(value).ToString
        Label4.Text = a3(value).ToString

    End Sub

End Class
Reply With Quote
  #2  
Old 04-14-2015, 03:49 AM
Flyguy's Avatar
FlyguyQuiz software - Random question from txt Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,163
Default

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt Quiz software - Random question from txt
Quiz software - Random question from txt
Quiz software - Random question from txt
 
Quiz software - Random question from txt
Quiz software - Random question from txt
 
-->