FIX: ActiveControl Property of Screen Object Loses Memory (113031)
The information in this article applies to:
- Microsoft Visual Basic Standard Edition for Windows 3.0
- Microsoft Visual Basic Professional Edition for Windows 3.0
This article was previously published under Q113031 SYMPTOMS
It is possible to receive an "Out of Memory" error when using the
ActiveControl property of the Visual Basic Screen object.
CAUSE
The ActiveControl property of the screen object can leak memory when used
with the Is operator.
RESOLUTION
Use a temporary variable to work around the problem. For example, change
the command click event in the code listed in the More Information section
below to this code:
Sub Command1_Click ()
Dim ctr As Long
Dim ActControl As control
Do
ctr = ctr + 1
Text1.Text = ctr
' Use a temporary object variable
Set ActControl = Screen.ActiveControl
If ActControl Is Command1 Then
End If
Loop
End Sub
This code should run indefinitely.
STATUS
Microsoft has confirmed this to be a bug in Visual Basic version 3.0
for Windows. This problem has been corrected in Visual Basic version 4.0.
Modification Type: | Major | Last Reviewed: | 10/29/2003 |
---|
Keywords: | kbbug kbfix KB113031 |
---|
|