?
Solved

Child forms & focus

Posted on 1998-06-23
4
Medium Priority
?
257 Views
Last Modified: 2010-05-03
I use child forms to show dbgrids and when I want to add new records to the database I show a form with modal 1; when in that form I have to show an error I use msgbox and that's the problem; when I close the msgbox the focus goes to the modal form, but when I close that form the focus goes to another application and my application is minimized instead of going to the child form. How can I change that and get the focus in the child form but without loosing the focus my application. I'm ussing VB5. Thanks.
0
Comment
Question by:girona
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:raygibbins
ID: 1464030
When you show the child form try the following

frmChild.Show vbModal, Me

Where ME is the parent form

Do you have code that minimizes the parent form ?
0
 

Author Comment

by:girona
ID: 1464031
I've tried raygibbins solution and it doesn't work. I obtain an error about I can't show a child in modal way.
I don't have any code to minimize the main form, it minimizes itself when I show a msgbox and close the modal form.
0
 
LVL 9

Accepted Solution

by:
Dalin earned 400 total points
ID: 1464032
goirona,
This is a Microsoft bug.
Check out:
BUG: Focus Does Not Return to an MDI parent form
http://support.microsoft.com/support/kb/articles/q180/7/47.asp
There is the explanation and a resolution.
Regards
Dalin
0
 
LVL 1

Expert Comment

by:raygibbins
ID: 1464033
girona

Sorry did not realise it was an MDI application

Try setting the WindowState property of all MDIchild forms to
2 - Maximized , in the properties window.
Or set them in code to vbMaximized
     
When you show an MDIChild window, then all other MDIChild forms take on the same WindowsState as the Active MDIChild


0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question