Using INPUT With Variable That Has Property Name Changes Code

ID: Q93672


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0


SYMPTOMS

Using the INPUT or INPUT # statement with a variable that has the same name as a property changes your source code which can hang the environment or result in an "Invalid Use of Object" error message.


STATUS

Microsoft has confirmed this to be a bug in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


MORE INFORMATION

The INPUT and INPUT # statements input data from a file or keyboard into a variable. However, when the environment unexpectedly encounters a property name instead of a variable name to store the data in, it will change your program's source code. This will produce the error message "Invalid Use of Object." This behavior does not occur in a compiled program. The compiler properly flags the error with an "Variable required" error message.

The following steps can be used to reproduce this problem:

  1. Start VBDOS.EXE.


  2. From the File menu select New Form... (Form1.Frm). Form1 will be created by default.


  3. Exit the Form Designer, save all changes.


  4. Add the following code to the Form_Click event procedure of Form1:
    
          SUB Form_Click()
              INPUT #1, BACKCOLOR
          END SUB 


  5. Press F5 to run the application. Notice that the INPUT # statement will change to "#1READ BACKCOLOR" and you will get an "Invalid Use of Object" error message or the environment will hang.


  6. Press F5 again and the code will change to "MID$(BACKCOLOR,, )= #1" and you will get another "Invalid Use of Object" error message or the environment will hang.


Additional query words: VBmsdos BUGLIST1.00 1.00

Keywords :
Version : MS-DOS:1.0
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.