0
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問題調查。創建一個包含以下每個問題的標籤的表單,以及每個問題的一組單選按鈕,其中包含以下回答:始終,通常有時很少,並且從不使用 使用2d數組累積每個問題的每個回覆的數量有一個菜單或按鈕選項,將在打印機上打印一個項目分析,顯示問題編號和每個響應的計數 即時嘗試打印多個調查答案的總和我想知道如何去做這個問題與二維陣列和打印