condition based color changing of labels

5 pts.
Tags:
VB.NET
Visual Studio 2008 Professional
Imports System.Data.OleDb
Imports System.Data
Imports System.Threading
Imports System.Data.SqlClient
Public Class Form1
    Dim bm As BindingManagerBase
    Dim ds As New DataSet
    Dim adp As OleDb.OleDbDataAdapter
    Sub showrecord(ByVal pos As Integer)
        Button1.Text = ds.Tables(0).Rows(pos)("Question")
        Button2.Text = ds.Tables(0).Rows(pos)("Option1")
        Button3.Text = ds.Tables(0).Rows(pos)("Option2")
        Button4.Text = ds.Tables(0).Rows(pos)("Option3")
        Button5.Text = ds.Tables(0).Rows(pos)("Option4")
    End Sub
    Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
        LabelX1.BackColor = Color.White
ds = New DataSet
        Dim dt As New DataTable
        Dim con As New OleDb.OleDbConnection("provider=sqloledb; server=MICROSOF-AE7D21SQLEXPRESS; database=mahaveer; userid=; password=;Trusted_Connection=yes;")
        con.Open()
        adp = New OleDb.OleDbDataAdapter("SELECT TOP 10 * FROM kbc ORDER By NEWID()", con)
        adp.Fill(ds, "kbc")
        bm = Me.BindingContext(ds, "kbc")
        bm.Position = 0
        showrecord(bm.Position)
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim result As DialogResult = MessageBox.Show("Are You Sure", "Millionaire", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If result = Windows.Forms.DialogResult.OK Then
            If Button2.Text = Button6.Text Then
                bm.Position += 1
                showrecord(bm.Position)
            Else
                Label2.Text = "Sorry Wrong Answer"
            End If
        End If
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
       Dim result As DialogResult = MessageBox.Show("Are You Sure", "Millionaire", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If result = Windows.Forms.DialogResult.OK Then
            If Button3.Text = Button6.Text Then
                bm.Position += 1
                showrecord(bm.Position)
            Else
                Label2.Text = "Sorry Wrong Answer"
            End If
        End If
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Dim result As DialogResult = MessageBox.Show("Are You Sure", "Millionaire", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If result = Windows.Forms.DialogResult.OK Then
            If Button4.Text = Button6.Text Then
                bm.Position += 1
                showrecord(bm.Position)
            Else
                Label2.Text = "Sorry Wrong Answer"
            End If
        End If
    End Sub
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
         Dim result As DialogResult = MessageBox.Show("Are You Sure", "Millionaire", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If result = Windows.Forms.DialogResult.OK Then
            If Button5.Text = Button6.Text Then
                bm.Position += 1
                showrecord(bm.Position)
            Else
                Label2.Text = "Sorry Wrong Answer"
            End If
        End If
    End Sub
End Class
i have written a quiz game in this code. i have 12 labels from LabelX1 to LabelX12.
here i want their background color white one by one when a user click on the correct answer.
how can i do that ?


Software/Hardware used:
vb.net 2008

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following