An application that dynamically adds controls to the Windows Form in a loop has a delayed response on the Microsoft Windows 98 operating system (814739)
The information in this article applies to:
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2003)
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual C# .NET (2003)
- Microsoft Visual C# .NET (2002)
- Microsoft Windows 98 Second Edition
SYMPTOMSIf you create an application that dynamically adds controls
to the Microsoft Windows Form in a loop, and then you run the application on a computer
that is running the Microsoft Windows 98 operating system, the application does
not respond for few minutes. CAUSEThe controls that are not in use are disposed implicitly
with the Controls.Dispose method. Controls.Dispose places the WM_CLOSE messages in the message queue. Because the
controls are added and removed in a loop, these WM_CLOSE messages are not
processed until the loop exits. When the loop exits, all the WM_CLOSE messages
are processed at the same time. Therefore, the application stops responding for several minutes.RESOLUTIONTo resolve this issue, follow these steps:
- Add the following statement to the code after the Panel1.Controls.Add statement.
Microsoft Visual Basic 2005 or Microsoft Visual Basic .NET code'Processes all Windows messages that are currently in the message queue.
Application.DoEvents() Microsoft Visual C# .NET code//Processes all Windows messages that are currently in the message queue.
Application.DoEvents(); - On the Build menu, click Build
Solution.
- Copy the recompiled executable that you created in the previous step
to the target computer, and then test it.
STATUS This
behavior is by design.REFERENCESFor more information, visit the following Microsoft Developer Network (MSDN) Web sites:
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbvs2005swept kbvs2005applies kbDeployment kbsetup kbForms kbDynamic kbWindowsForms kbCtrlCreate kbCtrl kbControl kbprb KB814739 kbAudDeveloper |
---|
|