473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Removing the form

Hello, I'm wondering what would be the best way to remove the main form from
a project, or at least hide it. My program is going to use a NotifyIcon
control to be in the system tray. I'd like to be able to open other forms
but don't need a main one. Is the only thing to set the opacity to 0%?

thanks
Nov 16 '05 #1
5 1173
Hi,

The "main" form is just like another form except that it's the one that is
created in the main() method, just set the correct properties of it and you
will never see it. IIRC you have to:
1- Set the status to minimized
2- Remove it from the taskbar
3- Remove it from the app listing ( control+tab )

and of course create the NotifyIcon :)

Just let me know if you want any code, I have an application like it.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Stephan Ainley" <ch*****@frayed.net> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hello, I'm wondering what would be the best way to remove the main form from a project, or at least hide it. My program is going to use a NotifyIcon
control to be in the system tray. I'd like to be able to open other forms
but don't need a main one. Is the only thing to set the opacity to 0%?

thanks

Nov 16 '05 #2

"Stephan Ainley" <ch*****@frayed.net> wrote in message
news:OQ**************@TK2MSFTNGP10.phx.gbl...
Hello, I'm wondering what would be the best way to remove the main form from a project, or at least hide it. My program is going to use a NotifyIcon
control to be in the system tray. I'd like to be able to open other forms
but don't need a main one. Is the only thing to set the opacity to 0%?

thanks

I suggest you look up "Form class" in the Visual Studio help. Form objects
have a Visible property, which may be what you are wanting, or you might
want to use the Hide() method. There are also Close() and Show() methods
which might be useful to you.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.
Nov 16 '05 #3
ShowInTaskbar = false
WindowState = Minimized

private void frmMain_Load(object sender, System.EventArgs e)

{

notifyIcon1.Icon = this.Icon;

}

private void frmMain_Resize(object sender, System.EventArgs e)

{

if (WindowState == FormWindowState.Minimized) Hide();

}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)

{

Show();

WindowState = FormWindowState.Normal;

}


Nov 16 '05 #4
Hi Claire,

IIRC this will still show the app when using control+tab , to avoid that I
know that I had to use P/Invoke (don't remember the exact method)
Maybe setting the Form.Text = "" solved this?

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Claire" <bl****@blahhhhh.com> wrote in message
news:eG*************@TK2MSFTNGP10.phx.gbl...
ShowInTaskbar = false
WindowState = Minimized

private void frmMain_Load(object sender, System.EventArgs e)

{

notifyIcon1.Icon = this.Icon;

}

private void frmMain_Resize(object sender, System.EventArgs e)

{

if (WindowState == FormWindowState.Minimized) Hide();

}

private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)

{

Show();

WindowState = FormWindowState.Normal;

}

Nov 16 '05 #5
Yes this worked, thank you all very much. At first it didn't work because I
had the form border style as a fixed dialog (to get rid of the app in the
alt+tab) but I changed it to a fixed single and that worked.

Also if anyone else is interested I added this on form closing:

e.Cancel = true;
this.WindowState = FormWindowState.Minimized;

so that the app could not be exited through the form. Since I wanted the
form to act as a property form then exit the app this is perfect.
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TP-Software | last post by:
Hi, I have a ChatFormCollection class which holds a collection of the class ChatForm which inherits from Form. MainForm has an instance of ChatFormCollection. When a ChatForm instance is...
6
by: JohnK | last post by:
ok, ya got me here. I'm trying to removing items from a dictionary inside a loop. Obviously using enumeration does not work as that assumes the dictionary stays unchanged. So how so I iterate...
8
by: Peter O'Reilly | last post by:
I have an HTML form with a textarea input box. When the user conducts a post request (e.g. clicks the submit button), an HTML preview page is presented to them with the information they have...
7
by: Utter Newbie | last post by:
Just wondeing if there is a way to keep from having a certain parameter sent when posting a form to another page (method=get)... So as an example a page will post something like this from a form...
2
by: bmgz | last post by:
I have written a simple function that validates a form based on the form objects' className attribute. The form basically write a "field required" message next to the form element that is blank(and...
2
by: C Glenn | last post by:
I've recompiled a DLL that contains a component. The component vanished from the form. I've since tried to replace it but most of the code associated with the component remained in the cs. The...
2
by: Nick | last post by:
Hi there, What does someone have to do to remove localization from a form?? It just keeps coming back again! I would like to try to assure that the property stays to "False" and the language...
2
by: Ike | last post by:
I have converted a huge vb6 app to .net. Now, I have 4 ocx controls (richtx32, commdlg32, etc) that I wish to remove from this application. Is there an easier way to do this than to go through it,...
6
by: Chris Chiasson | last post by:
Hi, After reading and experimenting for a several hours, I have this stylesheet: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"...
5
by: gnassar | last post by:
Essentially my problem is that .NET 2005 is removing my event handlers. There's no real special things about my project, it just continually removes them all. It starts on the open of a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.