smaple:
sub SomeSub()
static i as integer = 1
i+= 1
end Sub
strange as initial Value means first call the variable = has as default max
( 243..... ) integer as value.
is this normal?
Wolf 9 2138
Since you only incriment the value, are you saying in the debugger that you
look at the value on the first call and it is not 1 or 2 when you stop at the
i+=1 line?
"Wolf Saenger" wrote:
smaple:
sub SomeSub()
static i as integer = 1
i+= 1
end Sub
strange as initial Value means first call the variable = has as default max
( 243..... ) integer as value.
is this normal?
Wolf
Since you only incriment the value, are you saying in the debugger
that you look at the value on the first call and it is not 1 or 2 when
you stop at the i+=1 line?
"Wolf Saenger" wrote:
>smaple:
sub SomeSub() static i as integer = 1 i+= 1 end Sub strange as initial Value means first call the variable = has as default max ( 243..... ) integer as value.
is this normal?
Wolf
Thats ok
no the initial Value is i = Integer.Max
I was expecting i = 0
"Wolf Saenger" <wo**********@web.deschrieb:
>Since you only incriment the value, are you saying in the debugger that you look at the value on the first call and it is not 1 or 2 when you stop at the i+=1 line?
>>smaple:
sub SomeSub() static i as integer = 1 i+= 1 end Sub strange as initial Value means first call the variable = has as default max ( 243..... ) integer as value.
is this normal?
Wolf
Thats ok
no the initial Value is i = Integer.Max
I was expecting i = 0
The initial value should be 1 because you are initializing the static
variable to 1. However, after the first call the value of 'i' is 2.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hello Herfried K. Wagner [MVP],
"Wolf Saenger" <wo**********@web.deschrieb:
>>Since you only incriment the value, are you saying in the debugger that you look at the value on the first call and it is not 1 or 2 when you stop at the i+=1 line?
smaple:
sub SomeSub() static i as integer = 1 i+= 1 end Sub strange as initial Value means first call the variable = has as default max ( 243..... ) integer as value. is this normal?
Wolf
Thats ok
no the initial Value is i = Integer.Max I was expecting i = 0
The initial value should be 1 because you are initializing the static
variable to 1. However, after the first call the value of 'i' is 2.
Sorry it must be 1 Correct!
but it is the max value of a integer
so I'm astonished!
Wolf,
but it is the max value of a integer
Are you not mixing up a bit and an integer?
Cor
"Wolf Saenger" <wo**********@web.deschrieb:
>>>Since you only incriment the value, are you saying in the debugger that you look at the value on the first call and it is not 1 or 2 when you stop at the i+=1 line?
smaple: > sub SomeSub() static i as integer = 1 i+= 1 end Sub strange as initial Value means first call the variable = has as default max ( 243..... ) integer as value. is this normal? > Wolf > Thats ok
no the initial Value is i = Integer.Max I was expecting i = 0
The initial value should be 1 because you are initializing the static variable to 1. However, after the first call the value of 'i' is 2.
Sorry it must be 1 Correct!
but it is the max value of a integer
so I'm astonished!
* How do you call the method?
* How do you determine the value of 'i'?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
"Wolf Saenger" <wo**********@web.deschrieb
Sorry it must be 1 Correct!
but it is the max value of a integer
so I'm astonished!
I can't repro the problem in VB 2003, 2005, 2008. I single stepped into the
procedure. Before the assignment of 1, the value is 0. After the assignment,
it is 1. After the increment it is 2. Everything as expected.
When and where do you see the value?
Armin
Hello Armin,
you checked with static as declaration?
"Wolf Saenger" <wo**********@web.deschrieb
>Sorry it must be 1 Correct! but it is the max value of a integer so I'm astonished!
I can't repro the problem in VB 2003, 2005, 2008. I single stepped
into the procedure. Before the assignment of 1, the value is 0. After
the assignment, it is 1. After the increment it is 2. Everything as
expected.
When and where do you see the value?
Armin
"Wolf Saenger" <wo**********@web.deschrieb
Hello Armin,
you checked with static as declaration?
"Wolf Saenger" <wo**********@web.deschrieb
Sorry it must be 1 Correct!
but it is the max value of a integer
so I'm astonished!
I can't repro the problem in VB 2003, 2005, 2008. I single stepped
into the procedure. Before the assignment of 1, the value is 0.
After the assignment, it is 1. After the increment it is 2.
Everything as expected.
When and where do you see the value?
Yes.
Armin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: IamZadok |
last post by:
Hi
I was wondering if anyone knew how to convert a string or an integer
into a Static Char.
Thx
|
by: Jon Davis |
last post by:
I like the drag-and-drop accessibility of dragging a table to a Web Forms
designer and seeing a SqlDataAdapter automatically created for me.. being
able to create a DataSet from that is fun and...
|
by: The8thSense |
last post by:
how to declare static varible and static method inside a class ?
i try
"public static ABC as integer = 10"
and it said my declaration is invalid
Thanks
|
by: Dennis |
last post by:
I have a function which is called from a loop many times. In that function,
I use three variables as counters and for other purposes. I can either use
DIM for declaring the variables or Static. ...
|
by: Raghu |
last post by:
A local variable in a procedure can be declared as Static so that it can
retain value after the procedure ends. My question is: Does the variable
retain value among multiple objects of same type?...
|
by: Steve Blinkhorn |
last post by:
Does anyone know of a way of accessing and modifying variables declared
static within a function from outside that function? Please no
homilies on why it's bad practice: the context is very...
|
by: Zytan |
last post by:
I see that static is more restricted in C# than in C++. It appears
usable only on classes and methods, and data members, but cannot be
created within a method itself. Surely this is possible in...
|
by: RB |
last post by:
Hi clever people :-)
I've noticed a lot of people stating not to use static variables with
ASP.NET, and, as I understand it, the reason is because the variable is
shared across user sessions -...
|
by: HxRLxY |
last post by:
I am having a compile-time problem with a simple program I am writing. When I attempt to compile, I get the error "non-static variable this cannot be referenced from a static context". The error...
|
by: Andy B |
last post by:
I have a class that I want to make static but it uses some objects that are
instance objects. I keep getting a compiler error saying something about
using instance objects in a static class or...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |