Referencing to a variable from another form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • menyki
    New Member
    • Feb 2007
    • 33

    #1

    Referencing to a variable from another form

    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 updatemortality Form, 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

    Code:
    Public Class updtmortalityForm
        Inherits System.Windows.Forms.Form
        Public vivax1Integer, ovale1Integer, malariae1Integer, falciparum1Integer As Integer
        Public vivax2Integer, ovale2Integer, malariae2Integer, falciparum2Integer As Integer
        Public vivax3Integer, ovale3Integer, malariae3Integer, falciparum3Integer As Integer
        Public pvivax1Decimal, povale1Decimal, pmalariae1Decimal, pfalciparum1Decimal As Decimal
        Public pvivax2Decimal, povale2Decimal, pmalariae2Decimal, pfalciparum2Decimal As Decimal
        Public pvivax3Decimal, povale3Decimal, pmalariae3Decimal, pfalciparum3Decimal As Decimal
        Public nop1Integer, nop2Integer, nop3Integer As Integer
        Public eregion11Integer, neregion11Integer, eregion21Integer, neregion21Integer, eregion31Integer, neregion31Integer As Integer
        Public eregion1Decimal, neregion1Decimal, eregion2Decimal,
  • radcaesar
    Recognized Expert Contributor
    • Sep 2006
    • 759

    #2
    Originally posted by menyki
    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 updatemortality Form, 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

    Code:
    Public Class updtmortalityForm
        Inherits System.Windows.Forms.Form
        Public vivax1Integer, ovale1Integer, malariae1Integer, falciparum1Integer As Integer
        Public vivax2Integer, ovale2Integer, malariae2Integer, falciparum2Integer As Integer
        Public vivax3Integer, ovale3Integer, malariae3Integer, falciparum3Integer As Integer
        Public pvivax1Decimal, povale1Decimal, pmalariae1Decimal, pfalciparum1Decimal As Decimal
        Public pvivax2Decimal, povale2Decimal, pmalariae2Decimal, pfalciparum2Decimal As Decimal
        Public pvivax3Decimal, povale3Decimal, pmalariae3Decimal, pfalciparum3Decimal As Decimal
        Public nop1Integer, nop2Integer, nop3Integer As Integer
        Public eregion11Integer, neregion11Integer, eregion21Integer, neregion21Integer, eregion31Integer, neregion31Integer As Integer
        Public eregion1Decimal, neregion1Decimal, eregion2Decimal,


    Create instance of updatemortality Form in the predictForm.

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

    Like objUPdateMorali tyForm.Variable Name

    :)

    Comment

    Working...