home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / os / mswindo / programm / tools / 1975 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.6 KB

  1. Path: sparky!uunet!math.fu-berlin.de!news.th-darmstadt.de!bwl.bwl.th-darmstadt.de!hajo
  2. From: hajo@bwl.bwl.th-darmstadt.de (Hans-Jochen Schmitt)
  3. Newsgroups: comp.os.ms-windows.programmer.tools
  4. Subject: Scoping rules in VB 2.0 ?
  5. Date: 11 Jan 1993 12:40:15 GMT
  6. Organization: Inform.Systems Department, University of Darmstadt
  7. Lines: 32
  8. Message-ID: <hajo.81.0@bwl.bwl.th-darmstadt.de>
  9. NNTP-Posting-Host: bwlpc15.bwl.th-darmstadt.de
  10.  
  11.  
  12. The new VB 2.0 MDI support is fantastic ! True Form inheritance, autosizing 
  13. toolbars etc. etc....
  14.  
  15. But:
  16.  
  17. How do one manage to reference local varibales within a Form from outside ?
  18.  
  19. Problem:
  20.  
  21.   Assume a drawing form, that contains local variables (declared in the 
  22.   Declaration section of the Form). These variables describes the picture 
  23.   that is shown on the Form. When making instances from this Form, anything
  24.   works fine: every Form contains its own set of variables.
  25.   But: If you want to write a save-and-load logic for these Forms, you can 
  26.   not reference these Form-local variables from outside the Form (eg. the 
  27.   MDI-Desktop).
  28.   Is there any  way to reference instance-variables of a Form ? Something 
  29.   like ActiveForm.MyArray(1).MyName ?
  30.  
  31.   The only workaround so far I found is a very clumsy setup: 
  32.   - define a Button within the MDI-child
  33.   - make this Button invisible
  34.   - attach the Load or Save function to this Button
  35.   - "Click" this button (in the ActiveForm) from the MDI-menu option
  36.   The problem still remaining is that I can't pass parameters to the Form-
  37.   local procedure (execpt using the Tags from invisible controls).
  38.  
  39.   Any hints ?
  40.  
  41.   Hajo Schmitt
  42.   Technical University Darmstadt
  43.