.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 30th, 2003, 04:38 PM
Paul Belanger Paul Belanger is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 10 Paul Belanger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[VB.NET] How to hide startup form?

I was to hide my startup form because I only want to display my tray icon. Any ideas how to do this?

Reply With Quote
  #2  
Old August 30th, 2003, 07:43 PM
fwm fwm is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 fwm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can add a minimize event on load, if that your program is set to minimize to system tray!

Or you can add Me.Opacity = 0(Me.Opacity = 1 when clicked on systray icon again) on load, and then hide the taskbar button!

Reply With Quote
  #3  
Old September 4th, 2003, 06:36 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
1. // IDE: set opacity to 0

2. // IDE: add a timer to your form

3. timer.Enabled = true //enable the timer on form.Load event

4. me.hide() // the timer.Tick even hide form

5. me.opacity = 1 // the timer.Tick make form opacity back to normal

6. me.show() // yourNotifyIcon.click event

Reply With Quote
  #4  
Old September 5th, 2003, 01:08 AM
Nem Nem is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 109 Nem User rank is Private First Class (20 - 50 Reputation Level)Nem User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Why not just:

this.Visible = false;
this.ShowInTaskbar = false;

Reply With Quote
  #5  
Old October 15th, 2003, 06:22 AM
Pain Pain is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Sheffield, UK
Posts: 94 Pain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Pain
Hi guys,

Interesting thread this.

The method that i've implemented to do this was through the use of this code:

#Region "Taskbar Icon"
REM TASKBAR ICON

Private Sub NotifyIcon1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown
If Me.WindowState = FormWindowState.Normal Then
Me.WindowState = FormWindowState.Minimized
Else
Me.WindowState = FormWindowState.Normal
End If
End Sub
#End Region

On the form properties I also made sure that it didnt have appear in the task bar, nor have minimise/maximise/quit buttons..

However, to get to my question - i've tried using this opacity function to produce a 'fade in/out' type affair.

The code that I would use is (fade out):

Dim n

For n = 1 To 10

Me.ActiveForm.Opacity() = Me.ActiveForm.Opacity() - 0.1

Next

However, even though the code itself is correct, on running it, it'll produce the error message:

An unhandled exception of type 'System.NullReferenceException' occurred in Agility.exe

Additional information: Object reference not set to an instance of an object.

So..any takers to tell me whats going on?

All i want is for it to fade in/out on the system tray button click given if it is already in view or not.

Thanks

Reply With Quote
  #6  
Old October 15th, 2003, 06:40 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
prabably those code are running when no from active under your "Me"

try
Me.Opacity() -= 0.1

a tip to fading effect:
you should do your fade codes with threading method rather than just a simple loop.
for example, you can have a timer with interval of 100ms, every time the timer tick, you reduce the opacity by 0.1, until it reaches 0 (totally invisible) or whatever you want.
And to make it "solid" you do it with the timer again but isntead of reduce opacity, you increase it, until it reaches 1

And of course, if you want, you can create a separate thread and just run the loop with that second thread, however I found the timer method is easier.

Reply With Quote
  #7  
Old October 15th, 2003, 07:11 PM
Pain Pain is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Sheffield, UK
Posts: 94 Pain User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to Pain
thanks for the reply.

I found that using the timer was going to be the safest bet. To solve the problem, dont have your form minimised on startup folks

Yes, believe it or not, that was the answer...

Reply With Quote
  #8  
Old October 17th, 2003, 01:07 AM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
I believe you, if your form is minimised, I guess that will make it not 'Me.ActiveForm'

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > [VB.NET] How to hide startup form?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT