Solved

Me.Visible = False not working

Posted on 2006-07-07
12
599 Views
Last Modified: 2011-10-03
I have a main form in my app with the following code at the start of its Load event:

Me.Visible = False
Dim frmSplash As New frmSplash
frmSplash.Show()

The idea is that this will render my main form invisible then open my splash screen form. The splash screen form then opens a network connection using its Load event and then sets the main form as visible again and closes itself.

The only problem is that the main form won't set itself as invisible for long. It appears as invisible then the splash screen form opens and the main form makes itself visible again even if I dont included the code in the splash screen form to make it visible again.

Can anyone let me know why its doing this and how I can sort it out?

Many Thanks.
0
Comment
Question by:kiranboi
  • 3
  • 3
  • 2
  • +3
12 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17059498
Does the splash screen reference the main form anywhere?

Bob
0
 
LVL 9

Expert Comment

by:william007
ID: 17059542
You can put it at the activated event
    Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        Me.Visible = False
        Dim frmSplash As New frmSplash
        frmSplash.Show()
    End Sub
Alternatively, you can just set the startup form as frmSplash.
0
 

Author Comment

by:kiranboi
ID: 17059551
No
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 17059583
1) Is there anything kind of special Paint handling for the main form

2) What kind of controls are on the main form?

3) .NET version?  2002, 2003 or 2005?

Bob
0
 

Author Comment

by:kiranboi
ID: 17059610
nope, no special paint handling.

there's main menus, listviews, toolbars and panels on the main form

its .net version 2003
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17059644
try

Me.Hide
0
 

Author Comment

by:kiranboi
ID: 17059677
that gives me the same problem
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17059989
I suggest you use GotFocus event instead of Activated. Activated event is kinda dangerous
0
 
LVL 9

Expert Comment

by:william007
ID: 17060156
>>Activated event is kinda dangerous
What is the reason?
0
 
LVL 3

Expert Comment

by:maidinhtai
ID: 17062603
Because you are using .NET 2003, so have a look here:
http://msdn2.microsoft.com/en-us/library/754w18dd.aspx
It will be simpler with the form.Shown event if you use .NET 2005.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17064988
I am thinking that some underlying, unseen code from one of the controls is showing the form again, and pulling it on top.  The form has a VisibleChanged event, which you can define, and put a breakpoint into to see what is causing the form to become visible.

Bob
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 17068558
You can't hide the form from the Load event...   (it just doesn't work...dont' ask)

Either...

(1) Use a Sub Main() and show your splash form from there before showing your main form

(2) or use a Timer (with a short interval) in your main form and in the tick event make your form invisible from there.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

820 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