global variable vs local variable
i have a scenario like function is called more than 1000 times.in that function i declared a varible and assigning a value .i felt like declare a global varible use it in that function and assign value.which is best.please tell me in performance point of view.
thanks in advance
Hai Good Morning you have call the function more than 1000 times Better use Global variables, so you can call the function, anywhere.. it has good performance.suppose it you want assign different values to the variables , whenever the function has been called for that use local ...local variable & global variable
Hello, please see below:
var yourAge = myAge + 13;
var yourName = "John";
Question : Where are global variable "myAge" and "myName" stored? And
Where are local variable "yourAge" and "yourName" stored? They are
stored in context area?
How to make a variable receive an increment in the name?
I want to do it for example:
Label1->Caption = "1";
Label2->Caption = "2";
Label3->Caption = "3";
Label4->Caption = "4";
And I want to do something like that:
for (i=1; i<5; i++)
Label+i->Caption = i;
Any idea? Can I do something like that?
Thanks and regards
Create a vector of pointers to the various objects.
In your case below, construct a vector (called Labels) of pointers to TLable
long enough to hold pointers to...variable of variables
Say I have 2 scenarios and I want to use a different
variable depending on which scenario applies without coding
So I could have a database table t_variables which has:
In my Powerbuilder code I'd have values in v_name &
What I'd like to be able to do is to select which variable
to use from the table and assign that to something, e.g.
where scenario = 1
so at this point v_variable would be 'v_name'...variable not a variable
Error:Must declare the variable '@cartDateTime'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@cartDateTime'.
Dim connStr As SqlConnection Dim cmdInsert As SqlCommand Dim strInsert As String &n...Variable Variables
Maybe the solution is very simple, but how do I create variable variables in vb.net? I want to use the value of a variable as a part of the name of another variable. A very simple example below:
Dim a As String
a = "1"
Label a.Text = "hi"
<asp:Label id="Label1" runat="server">Label</asp:Label>
In need this to change a range of values by using just one loop. I can´t do that without creating a variable variable name.
check out this little demo application I created for you:
...Global variables / special variables / variable identifier with just one character
Expected error message: "Global symbol "$b" requires explicit package name".
However, I get result: "test".
I've checked the special variables and it looks like $b is one of these.
$_ = "test";
Does it mean - that in general - we should not use one character variables
"Adam" &l...shared variable versus global variable
I plan to implement a little timer service
for a certain window class to synchronize
some actions between all instances of
this class. For some reasons I want to
avoid the declaration of a global variable.
Now I think about the usage of a shared
variable for the service in this window class.
In the open event I would check if the
shared variable is already instantiated and
create the service if necessary. On close
of the last window of the class the service
should be destroyed from the garbage collector.
Do you think that this will work?
Thanks for hints
Chris Wern...how to change a treeview control contents when global variable is changed
i have built a main window ,and in this window ,i built a treeview
control,for some reason,i want to change the global variable,and thus the
treeview contents will change (the contents are some records selected from
a database,changed the global variables ,the sql where
condition is changed also).I have ever tried to use
w_main w_main2 to rebuilt it ,but it can not rebuild the treeview
control.So how can I get it?
Have you deleted all of the TreeViewItems from the control, then
specifically called each and every function/event used to populate it?
<janehu> wrote i...Local and global variables
Can someone explain the difference between
use vars qw/$defined_by_vars/ ;
our $defined_by_our ;
$not_explicily_defined = 1 ;
Are these all global to the package they are defined it.
...How to get a URL variable and set it to a local variable
Very easy question I presume. Does anyone know the answer to get a URL variable and set it to a local variable ?
dim myvar as string = Request.QueryString("someURLvar")Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/...Passing a variable to a sub (WAS: passing a variable to a module)
This is really more of a question of how to pass a variable to a sub. First
off, check out perldoc perlsub. To avoid problems like this, 'use strict'
whenever possible at the top of your scripts.
Anyway, here's how to fix this:
Passing a variable to a sub: All variables passed to subs are put into the
@_ array and then passed. Thus, when you do a printStatement($var), the
contents of $var are passed to the first element of the @_ array. In the
sub in your module, there is no such thing as the variable $var. If you had
used 'use strict', you would have ge...Create local variable
Background: IDM 3.5 and the Lotus Notes driver
On the subscriber channel:
I want to create a local variable which is based off the DN name of the
source object. For example, I was a local variable (call it LV1) to be
set to the value of the source DN. IE, LV1 = dn=frank,ou=ohio,o=US
One more thing with this local variable, i want to switch out the comma
(",") with a slash ("/"). LV1 should equal = dn=frank/ou=ohio/o=US.
Next, i want to set the destination variable LTPAUsrNm with the value
that I calculated above (dn=frank/ou=ohio/o=US).
I a...Defining autoinstantiate variables as global application variables
I�ve defined several global application variables that were
autoinstantiate Non visual classes.
After doing that strange problems happened: When saving window objects
PB always crashed.
No errors when rebuilding PBL�s or regenerate.
After moving these global variables to application manager NVUO (defined
as global but not autoinstantiate ) all problems disappeared.
I�m well aware about the problem defining global autoinstantiate
variables at PB 6.
Why this problem did not fixed in the last PB 7 build?
General info: PB 7 build 7024 , NT 4 SP 5