Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[VB.NET] Add a Minimize to Tray function

Newbie Spellweaver
Joined
Sep 29, 2012
Messages
89
Reaction score
17
Hey , today i came here to give you a quick explination of how to Add a Minimize to Tray function on your VB.NET form.

You need to add a button and a NotifyIcon

Then you need to go into Button code and write the following :

Me.Hide()
NotifyIcon1.Visible = True

Then go into the NotifyIcon code and write the following :

Me.Show()
NotifyIcon1.visible = False


That's it :)
You click the button and it hides and you double click in the icon on the tray and it opens back

Biblioteca13
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
i'd never use such function for any button, i'd rather use it on minimize or closing event.

for the closing event u even need a context menu on right click at the tray icon, however.
 
Newbie Spellweaver
Joined
Sep 29, 2012
Messages
89
Reaction score
17
God damn, if you're going to make a tutorial this useless at least provide a working example...

(c#)


This is a Basic tutorial for the ones that are iniciating Visual Basic.
I didn't know this either , i learned how to do it and i'm explaning it so other newbies can know about it
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
This is a Basic tutorial for the ones that are iniciating Visual Basic.
I didn't know this either , i learned how to do it and i'm explaning it so other newbies can know about it

NEWBIES? >.<
this is a 4 liner of controling the GUI, anybody who dont get this idea by themselves, should get a book first.
also if ppl learn c# on the correct way u dont even need to explain them how to do such things, they learn OOP, working with classes, data types, and then even with events. on this point they must solve this problem by themselves, or they arent programmer tbh. back in the day when i had no idea of c# i could already use the designer and get my events and change behaviours of my form. i wasnt a programmer to this time at all.
 
JavaScript Is Best Script
Joined
Dec 13, 2010
Messages
631
Reaction score
131
If you're gonna write a very basic tutorial at least teach the readers how to hook up a button clicked event to the button. I mean i really wouldn't know "Button code" and "NotifyIcon" are supposed to mean if i'm a total newbie.

OT : Very nice, i didn't knew NotifyIcon did that :D
 
Newbie Spellweaver
Joined
Sep 29, 2012
Messages
89
Reaction score
17
NEWBIES? >.<
this is a 4 liner of controling the GUI, anybody who dont get this idea by themselves, should get a book first.
also if ppl learn c# on the correct way u dont even need to explain them how to do such things, they learn OOP, working with classes, data types, and then even with events. on this point they must solve this problem by themselves, or they arent programmer tbh. back in the day when i had no idea of c# i could already use the designer and get my events and change behaviours of my form. i wasnt a programmer to this time at all.

This is visual basic.
And i already said it's a basic tutorial , people that are starting may not know this.
As when i started i didn't knew.
 
Joined
Apr 28, 2005
Messages
6,953
Reaction score
2,420
Doesn't matter if its visual basic.net or c#.net, they're both still .net so the syntax is nearly identical in most cases. The difference is visual basic code looks like it was written by a 12 year old.

You didn't explain how to create an onclick event for the button, you just say "go in to the code". This doesn't qualify as even a "basic tutorial" because you didn't explain how to actually do anything.

Go back to the Habbo section with this useless poop.
 
Newbie Spellweaver
Joined
Sep 29, 2012
Messages
89
Reaction score
17
Doesn't matter if its visual basic.net or c#.net, they're both still .net so the syntax is nearly identical in most cases. The difference is visual basic code looks like it was written by a 12 year old.

You didn't explain how to create an onclick event for the button, you just say "go in to the code". This doesn't qualify as even a "basic tutorial" because you didn't explain how to actually do anything.

Go back to the Habbo section with this useless poop.

At the point of adding some function people should already know how to go to a button code.
 
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
At the point of adding some function people should already know how to go to a button code.

ppl should even kno how to change properties and control the behaviour of their forms. go and learn something cool before posting any tuts for programmers.

if u say u did it for the absolute begginers outside, then u should explain how to get into the event code, otherwise your tut is uncomplete.
 
Joined
Aug 16, 2006
Messages
1,251
Reaction score
199
Step 1. Create a new project, select the Windows Forms Application and give it a name, for the purpose of this tutorial i decided to name my project, "MinimizeTray".


Step 2. Add a button to your form.



Step 3. In the properties panel, change the text of the button to something more appropriate than "Button1". I decided to make mine say, Minimize to Tray (re-size the button if needed to fix the text)



Step 4. Add a notify icon to your form.



Step 5. Change the visible property on your notify icon to "False" from the default "True", we don't want it visible until we tell it to be!


Step 6. Double click the button on the forum to switch from designer to code viewer/editor, and start the code of your button with the click event.


Step 7. First you want to hide the form, and then show the notify icon. Use the following code.
Code:
' Anything with an apostrophe at the beginning in a line is a comment.
' The first part of the code tells the current form to hide, we use Me.Hide() since its calling upon itself
' If we wanted to hide a different form (ex. Form2) we would use the forms name instead. (ex. Form2.Hide())
Me.Hide()
' This next part tells the notify icon to be visible.
NotifyIcon1.Visible = True


Step 8. Go back to the designer and double click on the notify icon control to open the code viewer/editor and start the code for your notify icon double click event.


Step 9. In the declarations combobox change "MouseDoubleClick" to "MouseClick"


Step 10. First you want to bring the form out of hiding, and then change the notify icon visibility back to "False". Use the following code.
Code:
' To show a form we use Me.Show() again if it were a different form we were calling on, we would use (ex. Form2.Show())        Me.Show()
        ' This next part tells the notify icon to be invisible again.
        NotifyIcon1.Visible = False


Compile and give yourself a pat on the back!


Thats how you do a tutorial.
 
JavaScript Is Best Script
Joined
Dec 13, 2010
Messages
631
Reaction score
131
VS2012, :w00t: :D

So sorry that i cant press the damn like button on my damn phone ><

2
 
Back
Top