473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Declaration level

33
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

Expand|Select|Wrap|Line Numbers
  1. Public Class votingsystemForm
  2.     Inherits System.Windows.Forms.Form
  3.     Private accordInteger, acInteger, anppInteger, apgaInteger as Integer
  4.  
  5.  
  6. Private Sub voteButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles voteButton.Click
  7.         If cpComboBox.SelectedIndex = 0 Then
  8.             accordInteger += 1
  9.         ElseIf cpComboBox.SelectedIndex = 1 Then
  10.             acInteger += 1
  11.         ElseIf cpComboBox.SelectedIndex = 2 Then
  12.             anppInteger += 1
  13.         ElseIf cpComboBox.SelectedIndex = 3 Then
  14.             apgaInteger += 1
  15.         Endif
  16. accordLabel.Text = accordInteger.ToString("F0")
  17. acLabel.Text = acInteger.ToString("F0")
  18. anppLabel.Text = anppInteger.ToString("F0")
  19. apgaLabel.Text = apgaInteger.ToString("F0")
Oct 28 '07 #1
0 711

Sign in to post your reply or Sign up for a free account.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
4
by: Helmut Dirtinger | last post by:
Hi Compontents of an xml file are mapped to the different node types of the xpath data model. An element is mapped to an element node, an attribute node represents an attribute and its value...
6
by: Tjerk Wolterink | last post by:
When i open the following xml file in internetexplorer: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE xc:content > <xc:xcontent...
7
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
5
by: Daniel Nichols | last post by:
I've noticed that in a C module (.c, .h file combination) that if you create a function's definition before it is used in other functions than a declaration is not necessary. I believe if the...
22
by: James Brodie | last post by:
I just wanted to get some advice on what are the better practices: 1) Should variables be declared at the beginning of a function or just before they are required? 2) Should all variabled be...
25
by: venky | last post by:
Hi main() { int x; /* it declaration or defination??*/ }
15
by: main() | last post by:
Hi all, When i compile following piece of code, # include <stdio.h> void fun(int val) { int val; /*problem is here*/ printf("%d\n",val);
18
by: sunny | last post by:
Hi Why does C allows declaration of variable inside switch block. ex: foll prg does not gives "undeclared "b" error msg. but also does not initialize b to 20 int a=1; switch(a) { int b=20;...
5
by: Gary Wessle | last post by:
Hi I read some where about the order variables are declared in a class may help space optimization. find the size of bits a variable takes and declare them from biggest to the lowest. so in my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.