Solved

Radio button selection gives same results

Posted on 2008-10-11
3
143 Views
Last Modified: 2012-05-05
I've created a group of radio button being used to select the correct answer of a question. I'm unsure why, but regardless of which one is selected, it always displays correct. Any suggestions?
~TIA
Private Sub btbOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btbOK.Click
        Timer1.Enabled = False
        Dim BoardForm As New frmQuestion
        If RB1.Tag = m_CorrectAnswer OrElse RB2.Tag = m_CorrectAnswer OrElse RB3.Tag = m_CorrectAnswer OrElse RB4.Tag = m_CorrectAnswer Then
            PlayerTotal = (m_sender * 200) + PlayerTotal
            MessageBox.Show("Correct!", "Correct", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Else
            MessageBox.Show("Sorry", "Wrong", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If

Open in new window

0
Comment
Question by:98fatboyrider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:jpaulino
ID: 22695736
With this :
"If RB1.Tag = mm_CorrectAnswer OrElse RB2.Tag = m_CorrectAnswer OrElse RB3.Tag = m_CorrectAnswer OrElse RB4.Tag = m_CorrectAnswer Then"
If any one of the radio buttons = m_CorrectAnswer then you will have a correct answer.
 
If have to include in each one if the radiobutton is selected and the tag = m_CorrectAnswer
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 22695750
Try this way instead:

        If (RB1.Checked AndAlso RB1.Tag = m_CorrectAnswer) OrElse (RB2.Checked AndAlso RB2.Tag = m_CorrectAnswer) OrElse (RB3.Checked AndAlso RB3.Tag = m_CorrectAnswer) OrElse (RB4.Checked AndAlso RB4.Tag = m_CorrectAnswer) Then
            PlayerTotal = (m_sender * 200) + PlayerTotal
            MessageBox.Show("Correct!", "Correct", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Else
            MessageBox.Show("Sorry", "Wrong", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End If

Open in new window

0
 

Author Closing Comment

by:98fatboyrider
ID: 31505376
That was it. Thank you.
0

Featured Post

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question