Click here to Skip to main content
15,898,020 members
Home / Discussions / C#
   

C#

 
AnswerRe: Move to next column in datagridview using a button Pin
Chazzysb15-Oct-08 3:33
Chazzysb15-Oct-08 3:33 
AnswerRe: Move to next column in datagridview using a button Pin
nelsonpaixao15-Oct-08 14:08
nelsonpaixao15-Oct-08 14:08 
QuestionChecking DateTimePicker date is => today's date? Pin
kanchoette15-Oct-08 1:15
kanchoette15-Oct-08 1:15 
AnswerRe: Checking DateTimePicker date is => today's date? Pin
Ashfield15-Oct-08 1:22
Ashfield15-Oct-08 1:22 
AnswerRe: Checking DateTimePicker date is => today's date? Pin
Giorgi Dalakishvili15-Oct-08 1:24
mentorGiorgi Dalakishvili15-Oct-08 1:24 
AnswerRe: Checking DateTimePicker date is => today's date? Pin
HemJoshi15-Oct-08 3:33
HemJoshi15-Oct-08 3:33 
AnswerRe: Checking DateTimePicker date is => today's date? Pin
mark_w_15-Oct-08 5:46
mark_w_15-Oct-08 5:46 
QuestionPut App in System Tray Not Working Pin
#realJSOP15-Oct-08 0:26
professional#realJSOP15-Oct-08 0:26 
XP64
VS2008
Compiling app for .Net 3.5

I've written some code to put my app in the system try but it's not working.

In my form, I've added a notifyIcon, a contextMenu, and an icon, and connected them all together (I added the components through the IDE's UI instead of manually typing everything in). I also have the following event handlers in the form:

//--------------------------------------------------------------------------------
private void NormalizeForm()
{
	if (this.WindowState == FormWindowState.Minimized)
	{
		this.Visible		= true;
		this.WindowState	= FormWindowState.Normal;
	}
	this.Activate();
	// remove icon from tray
	this.notifyIcon.Visible = false; 
}

//--------------------------------------------------------------------------------
private void MainForm_Load(object sender, EventArgs e)
{
	this.ShowInTaskbar		= false;
	this.Visible			= false;
	this.WindowState		= FormWindowState.Minimized;
	this.notifyIcon.Visible	= true;
}

//--------------------------------------------------------------------------------
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
	NormalizeForm();
}

//--------------------------------------------------------------------------------
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
	this.Close();
}

//--------------------------------------------------------------------------------
private void notifyIcon_DoubleClick(object sender, EventArgs e)
{
	NormalizeForm();
}


Where you see this.Visible = ..., I also tried this.Show() and this.Hide().

When the app starts, there is nothing in the task bar (as expected), the form isn't on the desktop (as expected), but the icon is NOT in the system tray either.

What am I missing?


"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


AnswerRe: Put App in System Tray Not Working Pin
Simon P Stevens15-Oct-08 0:49
Simon P Stevens15-Oct-08 0:49 
GeneralRe: Put App in System Tray Not Working Pin
#realJSOP15-Oct-08 0:59
professional#realJSOP15-Oct-08 0:59 
GeneralRe: Put App in System Tray Not Working Pin
Simon P Stevens15-Oct-08 1:13
Simon P Stevens15-Oct-08 1:13 
GeneralRe: Put App in System Tray Not Working Pin
#realJSOP15-Oct-08 2:34
professional#realJSOP15-Oct-08 2:34 
AnswerRe: Put App in System Tray Not Working Pin
Giorgi Dalakishvili15-Oct-08 1:04
mentorGiorgi Dalakishvili15-Oct-08 1:04 
GeneralRe: Put App in System Tray Not Working Pin
#realJSOP15-Oct-08 2:32
professional#realJSOP15-Oct-08 2:32 
GeneralRe: Put App in System Tray Not Working Pin
Giorgi Dalakishvili15-Oct-08 2:36
mentorGiorgi Dalakishvili15-Oct-08 2:36 
GeneralRe: Put App in System Tray Not Working Pin
#realJSOP15-Oct-08 2:41
professional#realJSOP15-Oct-08 2:41 
GeneralRe: Put App in System Tray Not Working Pin
#realJSOP15-Oct-08 6:56
professional#realJSOP15-Oct-08 6:56 
GeneralRe: Put App in System Tray Not Working Pin
Giorgi Dalakishvili15-Oct-08 7:07
mentorGiorgi Dalakishvili15-Oct-08 7:07 
QuestionCrystal report data Pin
Maddie from Dartford15-Oct-08 0:26
Maddie from Dartford15-Oct-08 0:26 
AnswerRe: Crystal report data Pin
Muhammad Shahid Farooq15-Oct-08 4:33
professionalMuhammad Shahid Farooq15-Oct-08 4:33 
AnswerRe: Crystal report data Pin
nelsonpaixao16-Oct-08 13:21
nelsonpaixao16-Oct-08 13:21 
QuestionTreeView mix combobox Pin
drcmomo15-Oct-08 0:23
drcmomo15-Oct-08 0:23 
Questionarray Pin
arkiboys14-Oct-08 23:57
arkiboys14-Oct-08 23:57 
AnswerRe: array Pin
Giorgi Dalakishvili15-Oct-08 0:07
mentorGiorgi Dalakishvili15-Oct-08 0:07 
AnswerRe: array Pin
Pete O'Hanlon15-Oct-08 0:11
mvePete O'Hanlon15-Oct-08 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.