hello people :)

found this site via google and its helped me a great deal so far but ive hit a snag.

from this topic:
http://www.daniweb.com/techtalkforums/thread19672.html

ive managed to create an app that will sit in the system tray and can be minimised and restroed again but the problem is it wont disepear from the task bar. being a complete begginner at this stuff i have no idea where to look.

i was wondering if anyone can help me heres my code:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication2
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.NotifyIcon notifyIcon1;
		private System.ComponentModel.IContainer components;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_Click);
			this.SuspendLayout();
			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
			this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
			this.notifyIcon1.Text = "notifyIcon1";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.notifyIcon1_MouseDown);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 266);
			this.Name = "Form1";
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void notifyIcon1_Click(object sender, EventArgs e)
		{
			if (this.WindowState == FormWindowState.Minimized)
				this.Show();
			this.WindowState = FormWindowState.Normal;
			this.Activate();
			notifyIcon1.Visible=true; //if you want to remove from tray when clicked on
		}
		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.Hide();
			notifyIcon1.Visible=true;
		}

		private void notifyIcon1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
		{
		
		}
	}
}

i added this to the onload procedure, great it works but it just moves the app so its floating above the start menu which is no good to me

this.ShowInTaskbar = false;

anyone have any idea idea what could be up
im sure its pretty simple but i cant see it

many thanks
adam

You have to set the Visible property to false, or call the this.Hide() method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.