Results 1 to 7 of 7

Thread: public variable doesn't change?!?

  1. #1

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    on my form load, i set a dimmed variable to the value of a public variable on another form:
    Code:
    Private Sub Form_Load()
       newSize = frmMain.prefList(1)
    End Sub
    Then I change the value of newSize, and when I unload the form, I set the public variable to the value of the dimmed value:
    Code:
    Private Sub Form_Unload()
       frmMain.prefList(1) = newSize
    End Sub
    but when I open the form back up, the value of frmMain.prefList(1) is unchanged, an idea why that could be??
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  2. #2
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    You declare public variables in a module.

  3. #3

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    actually, you can declare public variables on a form, you just have to reference them by the form on which they are declared, and as you can see, I have done that.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    do you have newsize declared?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5

    Thread Starter
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    yes i do, and I placed one of those red dots on the "End Sub" line of the Form_Unload() sub. In the immediate widow, the value of frmMain.prefList(1) remains unchanged.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  6. #6
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Hmm, this could be a tricky one, can you send your projects and i'll have a look?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  7. #7
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    hmm perhaps the form is unloading before the variable's value is passed? You could try placing that code in Form_QueryUnload and see if that works. I'd also set up a message box to kick off displaying newSize then frmMain.prefList(1) before the unload ... You may be able to pinpoint where and why it's dropping the value.
    -Excalibur

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width