https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/254703&feed=atom&action=history
Microsoft KB Archive/254703 - Revision history
2024-03-29T14:21:18Z
Revision history for this page on the wiki
MediaWiki 1.39.3
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/254703&diff=377755&oldid=prev
X010: Text replacement - """ to """
2020-07-21T12:52:56Z
<p>Text replacement - """ to """</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en-GB">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:52, 21 July 2020</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l72">Line 72:</td>
<td colspan="2" class="diff-lineno">Line 72:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Dim tmpView As Form1</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Dim tmpView As Form1</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Set tmpView = New Form1 </div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> Set tmpView = New Form1 </div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> tmpView.Caption = <del style="font-weight: bold; text-decoration: none;">&quot;</del>New Form<del style="font-weight: bold; text-decoration: none;">&quot;</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> tmpView.Caption = <ins style="font-weight: bold; text-decoration: none;">"</ins>New Form<ins style="font-weight: bold; text-decoration: none;">"</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> tmpView.Show</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> tmpView.Show</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>End Sub</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>End Sub</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l85">Line 85:</td>
<td colspan="2" class="diff-lineno">Line 85:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Private Sub Form_GotFocus() </div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Private Sub Form_GotFocus() </div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>' Comment out the next two lines to reproduce behavior</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>' Comment out the next two lines to reproduce behavior</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>MsgBox <del style="font-weight: bold; text-decoration: none;">&quot;</del>form got focus<del style="font-weight: bold; text-decoration: none;">&quot;</del></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>MsgBox <ins style="font-weight: bold; text-decoration: none;">"</ins>form got focus<ins style="font-weight: bold; text-decoration: none;">"</ins></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ctlFocus.SetFocus</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>ctlFocus.SetFocus</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>End Sub</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>End Sub</div></td></tr>
</table>
X010
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/254703&diff=139883&oldid=prev
3155ffGd: importing KB archive
2020-07-18T16:17:01Z
<p>importing KB archive</p>
<p><b>New page</b></p><div><div id="nsbanner"><br />
<br />
<div id="bannerrow1"><br />
<br />
{|<br />
| Knowledge Base<br />
|<br />
|}<br />
<br />
<br />
</div><br />
<div id="TitleRow"><br />
<br />
= <span id="KB254703"></span>PRB: Maximized MDI Child Form with Control Loses Focus =<br />
<br />
<br />
</div><br />
<br />
</div><br />
<div id="nstext" valign="BOTTOM"><br />
<br />
Article ID: 254703<br />
<br />
Article Last Modified on 5/13/2003<br />
<br />
<br />
-----<br />
<br />
APPLIES TO<br /><br />
<br /><br />
<br />
* Microsoft Visual Basic 6.0 Learning Edition<br />
* Microsoft Visual Basic 6.0 Professional Edition<br />
* Microsoft Visual Basic 6.0 Enterprise Edition<br />
<br />
<br />
-----<br />
<br />
<div class="notice_section"><br />
<br />
This article was previously published under Q254703<br />
<br />
</div><br />
<div class="symptoms_section"><br />
<br />
== SYMPTOMS ==<br />
<br />
When an MDI child form with a control is maximized, and another child form is created while the top child window is closed, the control on the original child form loses focus.<br />
<br />
</div><br />
<div class="cause_section"><br />
<br />
== CAUSE ==<br />
<br />
When the new child form is closed, the original form gets the focus instead of the control. The '''GotFocus''' event of the original form fires.<br />
<br />
</div><br />
<div class="resolution_section"><br />
<br />
== RESOLUTION ==<br />
<br />
=== Step-by-Step Workaround ===<br />
<br />
<ol><br />
<li>Start a new Standard EXE project in Visual Basic. Form1 is created by default.</li><br />
<li>Set the '''MDIChild''' property of Form1 to True.</li><br />
<li>Add a TextBox to Form1.</li><br />
<li>From the '''Project''' menu, add an '''MDI''' form to the project.</li><br />
<li>From the '''Tools''' menu, select '''Menu Editor''' and create a menu item on the MDI form with the caption <span class="kbd userinput"> New Form</span> and name it <span class="kbd userinput"> mnuNew</span>.</li><br />
<li><p>Add the following code to the MDI form:</p><br />
<pre class="codesample">Private Sub mnuNew_Click()<br />
Dim tmpView As Form1<br />
Set tmpView = New Form1 <br />
tmpView.Caption = &quot;New Form&quot;<br />
tmpView.Show<br />
End Sub<br />
</pre></li><br />
<li><p>Add the following code to the General Declarations area of Form1:</p><br />
<pre class="codesample">Dim ctlFocus As Object<br />
<br />
Private Sub Form_Deactivate()<br />
Set ctlFocus = Me.ActiveControl<br />
End Sub<br />
<br />
Private Sub Form_GotFocus() <br />
' Comment out the next two lines to reproduce behavior<br />
MsgBox &quot;form got focus&quot;<br />
ctlFocus.SetFocus<br />
End Sub<br />
</pre></li><br />
<li>Run the project and maximize Form1. The TextBox, Text1, has focus.</li><br />
<li>Click on the MDI menu '''New Form'''. A new form is created. Close the new form.</li><br />
<li>A message box indicates that the original form received the focus. Click '''OK'''. Focus is now set to the '''ActiveControl''' of the original form.</li><br />
<li>Comment out the specified lines and repeat the steps above to see the problem reproduced.</li></ol><br />
<br />
<br />
</div><br />
Keywords: kbmdi kbprb KB254703<br />
<br />
<div class="footer"><br />
<br />
<br /><br />
<br />
<br />
-----<br />
<br />
[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]<br />
<br />
<span>© Microsoft Corporation. All rights reserved.</span><br />
<br />
<br />
</div><br />
<br />
</div></div>
3155ffGd