473,503 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referencing to a variable from another form

33 New Member
How do i declare a variable in a form if i want to reference to the variable from another form. Below is a code on a form called updatemortalityForm, some variable on this form, i want to make use of them on another form called predictForm. how do i declare these variables so that i can make use of them on another form

Expand|Select|Wrap|Line Numbers
  1. Public Class updtmortalityForm
  2.     Inherits System.Windows.Forms.Form
  3.     Public vivax1Integer, ovale1Integer, malariae1Integer, falciparum1Integer As Integer
  4.     Public vivax2Integer, ovale2Integer, malariae2Integer, falciparum2Integer As Integer
  5.     Public vivax3Integer, ovale3Integer, malariae3Integer, falciparum3Integer As Integer
  6.     Public pvivax1Decimal, povale1Decimal, pmalariae1Decimal, pfalciparum1Decimal As Decimal
  7.     Public pvivax2Decimal, povale2Decimal, pmalariae2Decimal, pfalciparum2Decimal As Decimal
  8.     Public pvivax3Decimal, povale3Decimal, pmalariae3Decimal, pfalciparum3Decimal As Decimal
  9.     Public nop1Integer, nop2Integer, nop3Integer As Integer
  10.     Public eregion11Integer, neregion11Integer, eregion21Integer, neregion21Integer, eregion31Integer, neregion31Integer As Integer
  11.     Public eregion1Decimal, neregion1Decimal, eregion2Decimal, 
Oct 28 '07 #1
1 1423
radcaesar
759 Recognized Expert Contributor
How do i declare a variable in a form if i want to reference to the variable from another form. Below is a code on a form called updatemortalityForm, some variable on this form, i want to make use of them on another form called predictForm. how do i declare these variables so that i can make use of them on another form

Expand|Select|Wrap|Line Numbers
  1. Public Class updtmortalityForm
  2.     Inherits System.Windows.Forms.Form
  3.     Public vivax1Integer, ovale1Integer, malariae1Integer, falciparum1Integer As Integer
  4.     Public vivax2Integer, ovale2Integer, malariae2Integer, falciparum2Integer As Integer
  5.     Public vivax3Integer, ovale3Integer, malariae3Integer, falciparum3Integer As Integer
  6.     Public pvivax1Decimal, povale1Decimal, pmalariae1Decimal, pfalciparum1Decimal As Decimal
  7.     Public pvivax2Decimal, povale2Decimal, pmalariae2Decimal, pfalciparum2Decimal As Decimal
  8.     Public pvivax3Decimal, povale3Decimal, pmalariae3Decimal, pfalciparum3Decimal As Decimal
  9.     Public nop1Integer, nop2Integer, nop3Integer As Integer
  10.     Public eregion11Integer, neregion11Integer, eregion21Integer, neregion21Integer, eregion31Integer, neregion31Integer As Integer
  11.     Public eregion1Decimal, neregion1Decimal, eregion2Decimal, 


Create instance of updatemortalityForm in the predictForm.

Using that form's objname access the variable inside that.

Like objUPdateMoralityForm.VariableName

:)
Oct 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1666
by: J | last post by:
I'm wondering why the form created in the code below stays "alive". I would have thought that because the form variable is local to the method, that garbage collection would get rid of it. Makes...
7
6174
by: Dave | last post by:
I have two forms, Form1 and Form2. From Form2, how do I reference the value in a control on Form1? Or perhaps a more specific question: Form1 contains a textbox with the value of 10. This form...
6
11267
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
5
1793
by: Amelyan | last post by:
I am struggling here trying to determine what is a good programming practice as far as referencing your URLs. When you use Response.Redirect, do you use 1) Hard-coded string --...
2
4041
by: Axel | last post by:
Hi, a question about something that seems very simple at first glance: is it possible to reference other controls of a subform in a query window without referencing through the parent form? I...
3
1397
by: libsfan01 | last post by:
Hi all whats wrong with this script? i have named a form text box dynamically using php each row has a textbox called q101, q102 ... etc and i want to make sure my users dont input a quantity...
21
5066
by: cmd | last post by:
I have code in the OnExit event of a control on a subform. The code works properly in this instance. If, however, I put the same code in the OnExit event of a control on a Tab Control of a main...
5
1471
by: willywonka | last post by:
Hi again! hope there is no limit to posting newbies questions but this will probably be my last one for a while! I have managed to find some answers to other questions in my mind on here..yippy! ...
6
10773
by: viperRider | last post by:
Another question to people smarter than me! LOL I have a form with a variable - Dim cboOriginator as TextBox - that holds the info about a textbox i click on. when i click on it, i have a...
0
7198
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
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
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
7319
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
7449
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...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.