Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2003, 08:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Not Displaying

I have an MDI form that loads at start-up. Then I have a log-on form (which is NOT an MDI child) that is to be displayed modally.

The MDI form is called from Sub Main() and is shown by calling form.Show. Then a setup routine in the log-on form is called (form.Setup), This routine makes sure the form is centred in the screen and then displays it modally (Me.Show 1).

One of our clients (in France) has installed the software, however when he runs it, the log-on form is not being displayed automatically but the MDI form is.

If he clicks in the MDI form the log-on form appears.

The same happens if he presses [alt] and [tab].

If he types in his username and password while the log-on screen is not visible at start up and hits enter, he logs on successfully, even though the form is not being displayed.

This does not happen either in code or compiled here.

What could cause this type of problem?

Regards
Owain Williams
__________________
Regards
Owain Williams
 
Old July 8th, 2003, 08:41 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Owain

Try specifying the owner of the log-on form with the MDI form .

Example:
LogOn.Show vbModal, MDIForm

Stéphane Lajoie
 
Old July 8th, 2003, 08:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the suggestion Stéphane, I will give it a try.

I am concerned however that it is happening at all on his system and not on mine. Does anyone have any experience of this or a similar problem and who is the culprit (my code, corrupted executable, missing/outdated/corrupted component, target OS etc.)?

Regards
Owain Williams
 
Old July 8th, 2003, 09:09 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can you show us the code for the setup routine and the form show.

Stéphane Lajoie
 
Old July 8th, 2003, 09:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The MDI form is frmMain, the log-on form is frmLogOn. Here is the code:

Code:
Sub Main()

    frmMain.Show
    frmLogOn.Setup

End Sub



Private Sub MDIForm_Load()

    'Lots of code to decide whether they are licensed to use
    'the software, setting up global variables and pointers and
    'some other stuff, none of which accesses the frmLogOn form.
    Me.WindowState = vbMaximized

End Sub
This routine is in the frmLogon form:

Code:
Sub Setup

    'Centre the form (both vertically and horizontally)
    Me.Move ((Screen.Width - Me.Width)) / 2, (Screen.Height - Me.Height) / 2
    Me.Show 1

End Sub
That is all the code that is relevant I think.

Regards
Owain Williams
 
Old July 8th, 2003, 10:02 AM
Authorized User
 
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default

From what I have seen, every thing look ok. The problem could be cause by the MDI displaying after the Log-On form. I have seem something similar and it was cause by the difference in the computers speed. Try also adding a DoEvents before calling the frmLogOn.Setup.

Make sure that you don't have code in the event MDIForm_Activate that could give the focus to the MDI form.

Be sure that the frmLogOn.ShowInTaskbar is False.

That all I could think of what might be the problem.

Stéphane Lajoie
 
Old July 8th, 2003, 10:10 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your time. Your suggestions are very helpful and the cause could well be one of them. :)

Regards
Owain Williams
 
Old July 8th, 2003, 10:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jlick
Default

Be careful with DoEvents. It doesn't sound like you are doing any out of process stuff (at least at this point) but DoEvents can cause issues if you are. (It can change the order that things execute.)

I agree that your problem will probably be solved by passing in the MDIForm as the parent to the logon, or you could even have the MDIForm display the logon form.

I agree with Stéphane that is may be the speed of the computer, and the timing.

By the way: You can center the logon form in the screen by using the form's StartUpPosition property.


John R Lick
[email protected]
 
Old July 8th, 2003, 10:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 231
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help. I have had problems with DoEvents in the past and we do do some 'out of process stuff', but not at the point of start-up.

The computers speed does seem to be the most logical culprit.

Thanks for the StartUpPosition property tip, however someone else wrote the code before they knew of the property. Perhaps it will be changed one day :D

Regards
Owain Williams
 
Old July 10th, 2003, 01:05 AM
Authorized User
 
Join Date: May 2003
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you set the MDIChild property of the logon form to true. Try it.....by default it is false, change it to true.


Quote:
quote:Originally posted by owain
 Thanks for your help. I have had problems with DoEvents in the past and we do do some 'out of process stuff', but not at the point of start-up.

The computers speed does seem to be the most logical culprit.

Thanks for the StartUpPosition property tip, however someone else wrote the code before they knew of the property. Perhaps it will be changed one day :D

Regards
Owain Williams
Deepesh Jain
VB,VBA & .NET Specialist
Wiley Support Team





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying message on the form nasirmunir Javascript How-To 3 June 4th, 2008 10:20 PM
Displaying data in a struts form - Need help! [email protected] Struts 2 March 13th, 2007 01:17 PM
Displaying OLE object field in a form Rick Neifeld Access VBA 0 December 24th, 2003 02:16 PM
displaying png in web form dotnettergirl ASP.NET 1.0 and 1.1 Professional 0 July 16th, 2003 10:15 PM
displaying png in web form dotnettergirl Pro VB.NET 2002/2003 0 July 16th, 2003 10:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.