VB InputBox$() After Showing Modal Form Makes Form Modeless

ID Number: Q84548

1.00

WINDOWS

buglist1.00

Summary:

After you display a dialog box produced with the InputBox$ function

from a modal form, that form becomes modeless. However, the modal form

will remain modal after displaying another modal form or a dialog box

produced by the MsgBox function or statement.

Microsoft has confirmed this to be a problem with Microsoft Visual

Basic programming system version 1.0 for Windows. We are researching

this problem and will post new information here as it becomes

available.

More Information:

A modal form does not let the user switch focus to another window

until it is closed. However, if a dialog box is displayed from that

modal form through the InputBox$ function, the form then becomes

modeless. After responding to the dialog box, the user can change

focus by clicking on other forms of the application.

The workaround is to use another modal form instead of using the

InputBox$ function.

Steps to Reproduce Problem

--------------------------

1. Run Visual Basic, or from the File menu, choose New Project (ALT,

F, N) if Visual Basic is already running. Form1 is created by

default.

2. Place a command button (Command1) on Form1.

3. Add the following code to the Command1 Click event.

Sub Command1_Click ()

Form2.Show 1

End Sub

4. From the File menu, choose New Form (ALT, F, F) to create Form2.

Move the second form so that part of Form1 is visible.

5. Place a command button (Command1) on Form2.

6. Add the following code to the Form2 Command1_Click event:

Sub Command1_Click ()

s$ = InputBox$("Enter anything:")

End Sub

7. Press F5 to run the program.

Click on the command button on Form1, and Form2 will be displayed

modally. If you click on Form1, you cannot switch focus to it. Next,

click on the command button on Form2 to make the dialog box appear.

Choose the OK button or press ENTER. Focus returns to the modal form

Form2; however, Form2 is no longer modal. You can now click on Form1

and it will get the focus.

Additional reference words: 1.00