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

variables entre formularios

tengo un gran problemita... les comento que en vb yo utilizaba el Public
Shared para poder utilizar el valor de ese objeto en cualquier formulario,
ahora quiero hacer algo parecido en C# pero no se como, alguien me puede
ayudar???...
ej:
en vb es:
Public Shared matricula As String

en c#
???????

Marcelo
Jun 24 '07 #1
4 6356
El identificador alterno a Shared de VB......en C# es "static"
--
VBA
"Marcelo" wrote:
tengo un gran problemita... les comento que en vb yo utilizaba el Public
Shared para poder utilizar el valor de ese objeto en cualquier formulario,
ahora quiero hacer algo parecido en C# pero no se como, alguien me puede
ayudar???...
ej:
en vb es:
Public Shared matricula As String

en c#
???????

Marcelo
Jun 25 '07 #2
gracias por la respuesta, pero lo que me dices es que lo declare asi:
static String var1;.... hasta ahi todo bien.....
y suponiendo que le asigno un valor en mi primer formulario.... como lo
recuperaria en el otro formulario..... ahi es donde se me complica.

saludos,
Marcelo

"VBA" wrote:
El identificador alterno a Shared de VB......en C# es "static"
--
VBA
"Marcelo" wrote:
tengo un gran problemita... les comento que en vb yo utilizaba el Public
Shared para poder utilizar el valor de ese objeto en cualquier formulario,
ahora quiero hacer algo parecido en C# pero no se como, alguien me puede
ayudar???...
ej:
en vb es:
Public Shared matricula As String

en c#
???????

Marcelo
Jun 25 '07 #3
"Marcelo" <Ma*****@discussions.microsoft.comwrote in message
news:52**********************************@microsof t.com...
gracias por la respuesta, pero lo que me dices es que lo declare asi:
static String var1;.... hasta ahi todo bien.....
y suponiendo que le asigno un valor en mi primer formulario.... como lo
recuperaria en el otro formulario..... ahi es donde se me complica.
En el otro formulario, se recupera una variable estática poniendo
NombreDeLaClase.NombreDeLaVariable. Por ejemplo, si la clase del formulario
donde está declarado "static String var1" es "Form1", entonces desde
cualquier otro formulario se recupera como Form1.var1 .
Jun 26 '07 #4
Muchas gracias, funciona......

Saludos,
Marcelo

"Alberto Poblacion" wrote:
"Marcelo" <Ma*****@discussions.microsoft.comwrote in message
news:52**********************************@microsof t.com...
gracias por la respuesta, pero lo que me dices es que lo declare asi:
static String var1;.... hasta ahi todo bien.....
y suponiendo que le asigno un valor en mi primer formulario.... como lo
recuperaria en el otro formulario..... ahi es donde se me complica.

En el otro formulario, se recupera una variable estática poniendo
NombreDeLaClase.NombreDeLaVariable. Por ejemplo, si la clase del formulario
donde está declarado "static String var1" es "Form1", entonces desde
cualquier otro formulario se recupera como Form1.var1 .
Jun 26 '07 #5

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

Similar topics

5
by: Frédéric GACON | last post by:
Bonjour, Voila le morceau de code : setlocale(LC_TIME, "fr" ); $Diff = strftime ("%H:%M:%S, (mktime(12,0,0,1,1,1970) - mktime(6,0,0,1,1,1970))); $Diff Retourne 07:00:00
2
by: Hal Vaughan | last post by:
First, I am aware of both SwingUtilities.invokeLater(), and of using Thread to create a new thread.  These are part of the problem. I want to have something running in the background, while the...
4
by: Torsten Bronger | last post by:
Hallöchen! I have a file that looks a little bit like a C header file with a long list of variables (actually constants) definitions, e.g. VI_ATTR_TIMO = 0x54378 .... Actually I need this...
1
by: mark4asp | last post by:
What are the best methods for using global constants and variables? I've noticed that many people put all global constants in a file and include that file on every page. This is the best way of...
2
by: Patient Guy | last post by:
I have a library of functions representing a filesystem interface (essentially a file selection interface, to be used in opening/reading/writing/closing files). Heavily scripted HTML document...
9
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
7
by: misha | last post by:
Hello. I was wandering if someone could explain to me (or point to some manual) the process of mapping the addresses of host variables by DB2. Especially I would like to know when DB2 decides to...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.