Below is a code i wrote to perform some calculation and display the result on the same form, but when i hide the form and load another form, by the time i load the form again the values will be gone.So how do i declare the variables so that the form will be able to retain the result when i hide it and load it again
Code:
Public Class votingsystemForm
Inherits System.Windows.Forms.Form
Private accordInteger, acInteger, anppInteger, apgaInteger as Integer
Private Sub voteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles voteButton.Click
If cpComboBox.SelectedIndex = 0 Then
accordInteger += 1
ElseIf cpComboBox.SelectedIndex = 1 Then
acInteger += 1
ElseIf cpComboBox.SelectedIndex = 2 Then
anppInteger += 1
ElseIf cpComboBox.SelectedIndex = 3 Then
apgaInteger += 1
Endif
accordLabel.Text = accordInteger.ToString("F0")
acLabel.Text = acInteger.ToString("F0")
anppLabel.Text = anppInteger.ToString("F0")
apgaLabel.Text = apgaInteger.ToString("F0")