How To Get Labels Show Data Fr Db When I Click On Listview Item VS08

astrid22

New member
Joined
Jun 30, 2017
Messages
1
Programming Experience
Beginner
So I have this listview which shows just the titles of the available quizzes in my database. What I am trying to do is if I click on a quiz title, all the data (questions and answer options) associated with the quiz title will be shown on the right side through labels. And then they will be shown one by one with the use of buttons, like if they want to go to the next question or read the previous question. Is that possible?

Sorry I don't have a code to post as I absolutely have no idea how to do this.
sad.gif
/>

This is the only code I have, just to show the Quiz Titles:

VB.NET:
[/FONT]Public Class frmQuizSelector

    Dim dt1 As DataTable = New DataTable


    Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
        Me.Hide()
    End Sub


    Private Sub frmQuizSelector_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.lvwListOfQuizzes.View = View.Details
        Me.lvwListOfQuizzes.FullRowSelect = True
        Me.lvwListOfQuizzes.Columns.Add("Quiz Title", 270)
        Retrieve()
    End Sub


    Private Sub Populate(ByVal QuizTitle As String)
        Dim row As String() = New String() {QuizTitle}
        Dim item As New ListViewItem(row)
        Me.lvwListOfQuizzes.Items.Add(item)


    End Sub


    Private Sub Retrieve()
        Me.lvwListOfQuizzes.Items.Clear()


        Dim sql As String = "Select * from tblQuestions"
        AQuery = New OleDb.OleDbCommand(sql, AConn)


        Try
            AConn.Open()
            AAdapter = New OleDb.OleDbDataAdapter(AQuery)
            AAdapter.Fill(dt1)


            For Each row In dt1.Rows
                Populate(row(0))


            Next
        Catch ex As Exception
            MsgBox(ex.Message)
            AConn.Close()
        End Try






    End Sub

End Class[FONT=Verdana]

Please help :'(
 

Poppa Mintin

Well-known member
Joined
Jan 4, 2018
Messages
45
Programming Experience
10+
I don't understand why this question hasn't had an answer... Since June last year !

I expect you've found the answers yourself by now, however, if not you may find what you're looking for here:


Poppa.
 
Top Bottom