Microsoft KB Archive/92460

From BetaArchive Wiki
Knowledge Base


Use of VARPTR$() On Objects or Their Properties Unpredictable

PSS ID Number: 92460

Article Last Modified on 1/8/2003



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS 1.0



This article was previously published under Q92460

SUMMARY

Using the function VARPTR$() to return the address of controls or their properties can yield unpredictable results, it may even cause your system to hang.

This behavior occurs because objects and their properties move around in memory. Microsoft has confirmed that this behavior is by design.

MORE INFORMATION

For example, the following steps will cause your system to hang:

  1. Start VBDOS.EXE.
  2. From the File menu select New Form... (Form1.FRM).
  3. Add a text box (Text1) to the Form (Form1).
  4. From the File menu select Exit, save all changes.
  5. Add the following code to the Form_Click event procedure:

           SUB Form_Click ()
               PRINT "X" + VARPTR$(Text1.Text)
           END SUB
                            
  6. Run the application. It hangs.

Do not use the function VARPTR$() on controls or their properties.

This information, as well as other information about Microsoft Visual Basic for MS-DOS, version 1.0, can be found in the file README.TXT that was installed along with the product.


Additional query words: VBmsdos 1.00

Keywords: KB92460
Technology: kbAudDeveloper kbVB100DOS kbVBSearch kbZNotKeyword3