From your description, it appears that "integervar " only has local scope
within InitializeCompo nents. You need to declare it at the class scope
instead, then it will be visible to both InitializeCompo nents and the tick
event handler:
class MyClass
{
private int integervar;
private void InitializeCompo nent()
{
integervar = 0;
}
private void timer1_Tick(obj ect sender...
{
integervar++;
}
"Unknown" <Un*****@Unknow n.COM> wrote in message
news:Xn******** *************** ********@140.99 .99.130...
Hello i am new to C# and am having trouble with variable access.. What I
am doing is just making a timer, and within the tick event I want a variable
to increase a number.. for example
tick event:
integervar++;
end event
however each time I do this, visual studio is telling me that integervar
does not exist even though I have defined it in the initializecompo nents
method..