Solved

Child forms & focus

Posted on 1998-06-23
4
254 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 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

695 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