VB memory issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kjnhu
    New Member
    • Jul 2007
    • 7

    VB memory issue

    I am writing a program that runs off of a main() subroutine. There are a few operations and then an eternal while loop. If the user clicks on the tray icon and selects to update, how can I break out of the place I am at in the code and restart my main() subroutine without losing my variables? I am concerned about doing a call main() because then won't my stack keep growing since I am not exiting the place I was previously at in the main loop and not ending the subroutine that was called when "update" was clicked. Thank you.
  • kjnhu
    New Member
    • Jul 2007
    • 7

    #2
    My code looks as follows:

    Code:
    sub main()
    
    'some initialization and a few function calls
    
    dim loopvar as boolean = true
    while loopvar = true
    'some more function calls and a few application.run()
    end while
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    'here is the on_click method for the "update" button on the tray icon
    
    sub
    'here is where i need to somehow go back to a point a little before the eternal loop in main() on the button click, and i need to do this without creating memory issues if the "update" button is repeatedly clicked
    
    end sub

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Why do you need to "break out" of the main loop? Surely all you want to do is perform your operation, then continue on as before.

      Seems to me, the only time you'd need to break out of the loop is when it's time to exit.

      Comment

      Working...