在Visual Basic中保留选定的单选按钮

时间:2015-11-23 02:19:01

标签: vb.net visual-studio-2012 radio-button

我在使用后退按钮时遇到如何保留所选单选按钮的问题。

This is the page where I select the radio button.

这是上图的代码。

Public Class General_Questions_1
    Public Shared gen1_question5 As Integer
            If (q5_rate_9.Checked) Then
                gen1_question5 = 9
            ElseIf (q5_rate_8.Checked) Then
                gen1_question5 = 8
            ElseIf (q5_rate_7.Checked) Then
                gen1_question5 = 7
            ElseIf (q5_rate_6.Checked) Then
                gen1_question5 = 6
            ElseIf (q5_rate_5.Checked) Then
                gen1_question5 = 5
            ElseIf (q5_rate_4.Checked) Then
                gen1_question5 = 4
            ElseIf (q5_rate_3.Checked) Then
                gen1_question5 = 3
            ElseIf (q5_rate_2.Checked) Then
                gen1_question5 = 2
            ElseIf (q5_rate_1.Checked) Then
                gen1_question5 = 1
            Else
                gen1_question5 = 0
            End If

        End Sub

        Private Sub general_button_Click(sender As Object, e As EventArgs) Handles general_button.Click
            gen_question_1()
            Learning_Effectiveness.Show()
            Me.Close()
            Me.Dispose()
        End Sub

        Private Sub back_Click(sender As Object, e As EventArgs) Handles back.Click
            Me.Close()
            Main_Objective.Show()
        End Sub
    End Class

This is the next page of the first image.

这是上图的代码。

Public Class Learning_Effectiveness
    Public Shared le_question3 As Integer
        If (q3_rate_9.Checked) Then
            le_question3 = 9
        ElseIf (q3_rate_8.Checked) Then
            le_question3 = 8
        ElseIf (q3_rate_7.Checked) Then
            le_question3 = 7
        ElseIf (q3_rate_6.Checked) Then
            le_question3 = 6
        ElseIf (q3_rate_5.Checked) Then
            le_question3 = 5
        ElseIf (q3_rate_4.Checked) Then
            le_question3 = 4
        ElseIf (q3_rate_3.Checked) Then
            le_question3 = 3
        ElseIf (q3_rate_2.Checked) Then
            le_question3 = 2
        ElseIf (q3_rate_1.Checked) Then
            le_question3 = 1
        Else
            le_question3 = 0
        End If
    End Sub
    Private Sub leraning_button_Click(sender As Object, e As EventArgs) Handles leraning_button.Click
        le_question()
        Training_Content.Show()
        Me.Close()
        Me.Dispose()
    End Sub

    Private Sub back_Click(sender As Object, e As EventArgs) Handles back.Click
        Me.Close()
        General_Questions_1.Show()
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub
End Class

如果我在第二张图片中,那么我按下后退按钮。我可以保留用户选择的单选按钮。

0 个答案:

没有答案