Solved

Me.Visible = False not working

Posted on 2006-07-07
12
590 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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 …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 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

21 Experts available now in Live!

Get 1:1 Help Now