A Simple VB Question, but I can't figure it out!

Started by
1 comment, last by Radagar 21 years, 5 months ago
Hello all, I''ve been programming in C and C++ for a bit, but I''m trying to use Visual Basic to get a small program done quick... Now here is what I have... I have 2 Forms and a Module that is holding some global variables. Form1 has a button that when you click it, It hides Form1 and Shows Form2. Form 2 lists a gold value for the character. This Gold value is a global integer in the Globals module. When Form2 is shown the first time, it shows the correct value. However, if the gold value is changed anywhere else in the program, when I show form2 again, it still shows the old value. How do you refresh this? I''ve tried form2.refresh, that didn''t work. Basically it''s getting the value in the beginning with a line like...

Private Sub Form2_Load()
    GoldValueEditBox.Caption = Globals.GoldValue
End Sub
 
I hope I''ve made since.. When Form2 is loaded, it shows the right value, but if I hide the form, change the value, and show the form, it doesn''t update. ~~~~~~~~~~~ Chris Vogel ~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
Advertisement
The form isn''t reloaded when you hide it.

You might want to put that in Form_Activate (if memory serves well). That should get what you want done done.
I created Private Sub Form_Activate() and put my init code there, and it worked great.

That''s exactly what I needed. thanks!
WyrmSlayer RPG - In Early Development

This topic is closed to new replies.

Advertisement