Solved

Child forms & focus

Posted on 1998-06-23
4
248 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
  • 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now