Option Explicit On
Option Strict On
Public Class SurveyForm
Structure Question
Dim QuestionString As String
End Structure
Structure Answer
Dim AnswerInteger As Integer
End Structure
Private QuestionGroup(9) As Question
Private AnswerGroup(9, 4) As Answer
Private indexinteger As Integer = 0
Private Sub QuestionGroupBox_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuestionGroupBox.Enter
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub
Private Sub SurveyForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim always As Integer
Dim never As Integer
Dim seldom As Integer
Dim sometimes As Integer
Dim usually As Integer
If AlwaysRadioButton.Checked = True Then always += 1
If NeverRadioButton.Checked = True Then never += 1
If SeldomRadioButton.Checked = True Then seldom += 1
If SometimesRadioButton.Checked = True Then sometimes += 1
If UsuallyRadioButton.Checked = True Then usually += 1
AlwaysRadioButton.Checked = False
NeverRadioButton.Checked = False
SeldomRadioButton.Checked = False
SometimesRadioButton.Checked = False
UsuallyRadioButton.Checked = False
QuestionGroup(0).QuestionString = "Question 1: Do you read the textbook chapter after class"
QuestionGroup(1).QuestionString = "Question 2: Do you complete the homework when it is assigned"
QuestionGroup(2).QuestionString = "Question 3: Do attend class regularly"
QuestionGroup(3).QuestionString = "Question 4: Do you participate in class discussions"
QuestionGroup(4).QuestionString = "Question 5: Do you participate in a study group"
QuestionGroup(5).QuestionString = "Question 6: Do you answer questions in the textbook"
QuestionGroup(6).QuestionString = "Question 7: Do you practice with the hands on excersice"
QuestionGroup(7).QuestionString = "Question 8: Do you try little projects to test all new topics"
QuestionGroup(8).QuestionString = "Question 9: Do you ask questions when you are unsure about a topic?"
QuestionGroup(9).QuestionString = "Question 10: Do you use the online help to learn more about each feature?"
AnswerGroup(0, 0).AnswerInteger = always
End Sub
Private Sub BeginSurveyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeginSurveyButton.Click
QuestionLabel.Text = QuestionGroup(indexinteger).QuestionString
If indexinteger < QuestionGroup.Length Then
indexinteger += 1
If indexinteger = 10 Then
QuestionLabel.Text = "Thank you for completing the survey"
End If
End If
BeginSurveyButton.Text = "Next Question"
If indexinteger = 10 Then
BeginSurveyButton.Enabled = False
End If
If AlwaysRadioButton.Checked = False Then
If NeverRadioButton.Checked = False Then
If SeldomRadioButton.Checked = False Then
If SometimesRadioButton.Checked = False Then
If UsuallyRadioButton.Checked = False Then
MessageBox.Show("Please select an answer", "Invalid Answer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
indexinteger -= 1
End If
End If
End If
End If
End If
PrintButton.Enabled = False
NextButton.Enabled = False
If indexinteger = 10 Then
PrintButton.Enabled = True
NextButton.Enabled = True
End If
End Sub
Private Sub AlwaysRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AlwaysRadioButton.CheckedChanged, NeverRadioButton.CheckedChanged, SeldomRadioButton.CheckedChanged, SometimesRadioButton.CheckedChanged, UsuallyRadioButton.CheckedChanged
End Sub
Private Sub NextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextButton.Click
NextButton.Enabled = False
PrintButton.Enabled = False
BeginSurveyButton.Enabled = True
QuestionLabel.Text = QuestionGroup(0).QuestionString
NeverRadioButton.Checked = False
AlwaysRadioButton.Checked = False
SeldomRadioButton.Checked = False
SometimesRadioButton.Checked = False
UsuallyRadioButton.Checked = False
End Sub
End Class
これが私のコードです。タスクは、ユーザーが 10 の質問の調査を完了するプロジェクトを作成することです。次の各質問のラベルと、次の応答を含む各質問のラジオ ボタンのグループを含むフォームを作成します。質問番号と各回答のカウントを示す項目分析をプリンターに印刷するメニューまたはボタン オプション 複数の調査の回答の合計を印刷しようとしている どうすればそれを行うことができるか疑問に思っています