473,320 Members | 1,848 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,320 software developers and data experts.

App Module variable (VB-C#)

Hi All,

I was used to have a few global variables in VB module, so that each form or
class can share the same value.
Now in C#, I don't know how to do it. Is there an easy way?

Thanks for any tip,
Anony
Nov 15 '05 #1
1 1482
Hi,

The best thing you can do, tnstead of global variables, is to have a static members in a public class.
Create public classes with same name as your modules. Declare the variables using static keyword so that they are shared across all references to these vaiables.
for example.

public class MyModule
{
public static int myGlobalVar1;
public static string myGlobalVar2;
}

and use them as MyModule.myGlobalVar1 and MyModule.myGlobalVar2

thanks
Nithin P V

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stefan Quandt | last post by:
I want to set a modules global variable from outside like this: <begin a.py> v = None def setv( x ): v = x def getv(): return v <end a.py> <begin b.py>
0
by: mg | last post by:
Hi everybody... I am using Python API in order to create bindings. So, in the init function of my module, I create constants : PyMODINIT_FUNC initMyModule( void ) { PyObject* module =...
1
by: mg | last post by:
Hi everybody... I am using Python API in order to create bindings. So, in the init function of my module, I create constants : PyMODINIT_FUNC initMyModule( void ) { PyObject* module =...
2
by: TNGgroup | last post by:
Hi, a Simple Question, I have some code at my form, the code in the form is calling a certain module and execute some code, a certain variable is set to strTemp. but when de module is done. I...
10
by: Brian | last post by:
If i declare a module level oledbconnection with each request for the page, the variable remains in scope? I get open.executing error message on subsequent calls for the page. I assumed ASP.Net...
7
by: SamSpade | last post by:
If I define a variable in a module there is only one instance of the variable for all instances of the class. If I define a variable within a class there is an instance of the variable for each...
7
by: gabriel.becedillas | last post by:
I have a module that defines a variable with a constant value and now I need to make that value dynamic, without affecting module clients. In other words, I need to call a function witout using...
17
by: GinTon | last post by:
How to access to a variable (that value is not returned) from a module imported? And the variable is set at the module-level. That module is external to my program, it's from another project so...
8
by: Jeff | last post by:
Still new to vb.net in VS2005 web developer... What is the proper/standard way of doing the following - setting the value of a variable in one sub and calling it from another? E.g., as below....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
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...
0
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...
0
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...
1
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.