Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

using listview control for quiz application

$
0
0
in my quiz application, i use list view to display the questions alongwith three choices .
the code for this is--

Code:

      Dim listSql As String = "Select  * from qna "
        Dim cmd As OleDbCommand = New OleDbCommand(listSql, DBconnection)
        Dim dr As OleDbDataReader = cmd.ExecuteReader

        Do While dr.Read()
            Dim new_item As New ListViewItem(dr.Item("ID").ToString)
            new_item.SubItems.Add(dr.Item("Question").ToString)
            new_item.SubItems.Add(dr.Item("Option A").ToString)
            new_item.SubItems.Add(dr.Item("Option B").ToString)
            new_item.SubItems.Add(dr.Item("Option C").ToString)
            questionList.Items.Add(new_item)
        Loop
        DBconnectionClose()

what i want to do is add a last column where the user can select one out of the three options preferably using a combobox . After the user selects the answer for all the questions( rows) the score must be calculated by using a command button or something like that. how should i proceed in order to add the last column and calculate the score? do i have to use a datatable?

i am also open to other alternatives besides listview or the combobox. thanks..

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>