Solved

Me.Visible = False not working

Posted on 2006-07-07
12
605 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
[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
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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 86

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

728 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