Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I've been making Quiz Program in VB.Net, I wanna create next button to change question but in same form, as what would be the way that I should use to create next question to appear but without changing the form for suppose I use multiple forms it makes my application loaded. so please help me out to appear next question in same form and
How could I use marquee in VB.Net forms?
Thanks in advance.

What I have tried:

I've tried labels but couldn't do that.
Updated 30-Mar-16 7:14am
Patrice T 30-Mar-16 11:20am    
Show your code and explain what is your problem.
Kschuler 30-Mar-16 12:27pm    
Why didn't labels work? If you have a list of questions, set the label's text property to the first question. When they click the next button, set the label's text property to the next question in the list.
Sergey Alexandrovich Kryukov 30-Mar-16 15:37pm    
To start with, you should have told us what do you mean by "Label". Which one? Full type name, please.

1 solution

You Could make a list of an object: The object can be called question , which consists of two strings a question and its answer. These object can be placed into a list of the questions and answers, in using a button you can create a counter that will be used to call a an item in the list. This item in the list and be made back into the object see code below

Public Class Form1
    Dim coutner As Integer = 0
    Dim qs As List(Of Questions)
    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        qs = makeQuestion()
    End Sub

    Private Function makeQuestion()
        Dim q1 As New Questions

        q1.qestion = "What Continent is Senegal on? "
        q1.answer = "Africa"

        Dim q2 As New Questions
        q2.qestion = "What Continent is Azerbaijan on? "
        q2.answer = "Europe"

        Dim qs As New List(Of Questions)


        Return qs
    End Function

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim qst As Questions = qs(coutner)

        Dim qwest As String = qst.qestion
        Dim ans As String = qst.answer

        TextBox1.Text = qwest
        coutner += 1

    End Sub

End Class

Question Object

Public Class Questions
    Public Property qestion As String = String.Empty
    Public Property answer As String = String.Empty

    Public Sub New()
        'Empty Constructor
    End Sub
End Class
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900