Write a Vb.net program to design the following form, select the question number from combo box that question will be displayed into textbox and the options for that question will be displayed on four radio buttons, select option and click on submit button result should be displayed in another textbox.
SLip No. 14


Public Class Form1
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedItem() = "Question 1" Then
RichTextBox1.Text = "What is Capital Of India ?"
RadioButton1.Text = "Delhi"
RadioButton2.Text = "Pune"
RadioButton3.Text = "Mumbai"
RadioButton4.Text = "Chennai"
End If
If ComboBox1.SelectedItem() = "Question 2" Then
RichTextBox1.Text = "What is Capital Of Maharashtra ?"
RadioButton1.Text = "Pune"
RadioButton2.Text = "Nagpur"
RadioButton3.Text = "Mumbai"
RadioButton4.Text = "Nagar"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim correct As String
Dim wrong As String
correct = "Answer is correct"
wrong = "Answer is wrong"
If ComboBox1.SelectedItem() = "Question 1" Then
If RadioButton1.Checked Then
TextBox1.Text = correct
ElseIf RadioButton2.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton3.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton4.Checked Then
TextBox1.Text = wrong
End If
End If
If ComboBox1.SelectedItem() = "Question 2" Then
If RadioButton1.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton2.Checked Then
TextBox1.Text = wrong
ElseIf RadioButton3.Checked Then
TextBox1.Text = correct
ElseIf RadioButton4.Checked Then
TextBox1.Text = wrong
End If
End If
End Sub
End Class
Comments
Post a Comment