Need Help with visual basic code. Warren High School. This year, three students
ID: 3576924 • Letter: N
Question
Need Help with visual basic code.
Warren High School.
This year, three students are running for senior class president: Mark Stone, Sheima Patel, and Sam Perez. Create an application that keeps track of the voting – for each click on the “Record Vote” button, a corresponding vote is recorded for the candidate selected in the list. Save the voting information in a sequential access file. The application also should display the number of votes per candidate. A design suggestion for the form is shown below:
Warren High School Candidate: Mark Stone Sheima Patel Sam Perez Mark Stone Sheima Pate Record Vote Display votes Exit Sam Perez:Explanation / Answer
Private Sub CommandButton3_Click()
this.Close
End Sub
Private Sub DisplayVotes_Click()
x = 0
y = 0
z = 0
TextBox1.Text = x
TextBox2.Text = y
TextBox3.Text = z
End Sub
Private Sub RecordVote_Click()
Dim x As Integer
Dim y As Integer
Dim z As Integer
If (ListBox1.Selected = "Mark Stone") Then
x = x + 1
If (ListBox1.Selected = "Sheima Patel") Then
y = y + 1
If (ListBox1.Selected = "Sam Perex") Then
z = z + 1
Dim tmp as String
Open "C:Votes.txt" For Append As #1
Write #1, TextBox1.txt
Write #1, TextBox2.txt
Write #1, TextBox3.txt
Close #1
END SUB
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.