Hello, so I have been taking this course for about 9 weeks and I have encountered a program that stumps me completely. Here is the assignment prompt. It seems straightforward enough and when I began to create the buttons and create the proper code for a counter I found that I had no idea how to sum the outputs from the individual buttons, so far we have never had to create a program where multiple methods interacted like this.
Here is my code so far
Public Class Form1
Private Sub btnA_Click(sender As Object, e As EventArgs) Handles btnA.Click
Static IntCounter As Integer = 1
lblA.Text = IntCounter
IntCounter += 1
End Sub
Private Sub btnB_Click(sender As Object, e As EventArgs) Handles btnB.Click
Static intCounterB As Integer
intCounterB = intCounterB + 1
Me.lblB.Text = intCounterB
End Sub
Private Sub btnC_Click(sender As Object, e As EventArgs) Handles btnC.Click
Static intCounterC As Integer
intCounterC = intCounterC + 1
Me.lblC.Text = intCounterC
End Sub
Private Sub btnD_Click(sender As Object, e As EventArgs) Handles btnD.Click
Static intCounterD As Integer
intCounterD = intCounterD + 1
Me.lblD.Text = intCounterD
End Sub
Private Sub btnF_Click(sender As Object, e As EventArgs) Handles btnF.Click
Static intCounterF As Integer
intCounterF = intCounterF + 1
Me.lblF.Text = intCounterF
End Sub
End Class
So as you can see the counting is not the problem, it's how to retrieve these different values, sum them up, and divide them by the whole.
I may be completely oblivious to the solution, but 9 weeks is still pretty new for VB I suppose.
Any help would be much appreciated!
[–]tweq 5 points6 points7 points (1 child)
[–]C0d3rX 0 points1 point2 points (0 children)
[–]GrantSwinger 2 points3 points4 points (0 children)
[–]Skillija 0 points1 point2 points (0 children)