41 Replies - 2890 Views - Last Post: 18 March 2012 - 03:50 AM
#1
Question in Radiobutton
Posted 03 March 2012 - 11:36 PM
2.I am using radiobutton to choose a answer then if done answering you need to click Next Button.
3.I really don't know what codes i need to put in the radiobutton that will determine answer is correct and how to add the right answer he did get.
Replies To: Question in Radiobutton
#2
Re: Question in Radiobutton
Posted 03 March 2012 - 11:38 PM
#3
Re: Question in Radiobutton
Posted 03 March 2012 - 11:44 PM
Attached image(s)
#4
Re: Question in Radiobutton
Posted 04 March 2012 - 12:08 AM
And instead of posting screenshots, its better to post your code here. Use the code tags.
And also I'll elaborate my answer in the previous post a little bit here.
To keep score, you must have a global variable. The easiest way to do that is create a Module and declare a variable there so that you can access it from anywhere within your program.
When a form's Next button is clicked, hide the current form, show the next form. In the meantime, use an If Else statement to evaluate the given answer in each form. If the correct Radiobutton is checked, increment the global variable by 1. Same scenario for all the forms and in the end, you only have to display that variable in a Label or Textbox or I dunno. There you have the final score.
This post has been edited by nK0de: 04 March 2012 - 12:11 AM
#5
Re: Question in Radiobutton
Posted 04 March 2012 - 12:59 AM
#6
Re: Question in Radiobutton
Posted 04 March 2012 - 01:06 AM
I think you can make use of the Random Class in VB.NET. Haven't really done something like that personally so can't be 100% sure but give it a whirl.
#7
Re: Question in Radiobutton
Posted 04 March 2012 - 04:22 AM
#8
Re: Question in Radiobutton
Posted 04 March 2012 - 05:46 AM
Public Class MathQ1
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs)
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Hide()
MathQ2.Show()
End Sub
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged
If Me.RadioButton1.Checked = True Then score += 1
End Sub
Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton2.CheckedChanged
End Sub
Private Sub RadioButton3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton3.CheckedChanged
End Sub
Private Sub RadioButton4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton4.CheckedChanged
End Sub
End Class
Public Class MathQ2
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Me.Hide()
MathQ3.Show()
End Sub
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged
End Sub
Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton2.CheckedChanged
End Sub
Private Sub RadioButton3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton3.CheckedChanged
If Me.RadioButton3.Checked = True Then score += 1
End Sub
Private Sub RadioButton4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton4.CheckedChanged
End Sub
End Class
Public Class MathQ3
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Call MsgBox("Congratulations, your score is " & score, vbOKOnly Or vbInformation, "Score")
Me.Hide()
MathQ4.Show()
End Sub
Private Sub RadioButton1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged
End Sub
Private Sub RadioButton2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton2.CheckedChanged
End Sub
Private Sub RadioButton3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton3.CheckedChanged
If Me.RadioButton3.Checked = True Then score += 1
End Sub
Private Sub RadioButton4_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton4.CheckedChanged
End Sub
End Class
#9
Re: Question in Radiobutton
Posted 04 March 2012 - 05:54 AM
say, in Form1 the correct answer is Radiobutton1. So something simple like this would do,
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
Me.Hide()
Form2.Show()
If RadioButton1.Checked = True Then
score += 1
End If
End Sub
This post has been edited by nK0de: 04 March 2012 - 05:55 AM
#10
Re: Question in Radiobutton
Posted 04 March 2012 - 05:55 AM
#11
Re: Question in Radiobutton
Posted 04 March 2012 - 06:03 AM
#12
Re: Question in Radiobutton
Posted 04 March 2012 - 06:26 AM
Public Class MathScore
Private Sub MathScore_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Call MsgBox("Congratulations, your score is " & score, vbOKOnly Or vbInformation, "Score")
End Sub
End Class
#13
Re: Question in Radiobutton
Posted 04 March 2012 - 06:33 AM
This post has been edited by nK0de: 04 March 2012 - 06:36 AM
#14
Re: Question in Radiobutton
Posted 04 March 2012 - 08:57 AM
#15
Re: Question in Radiobutton
Posted 04 March 2012 - 09:13 AM
There is a simple way to speak up what's in the .Text property of controls. Take a look at this video.
This post has been edited by nK0de: 04 March 2012 - 09:24 AM
|
|

New Topic/Question
Reply



MultiQuote





|