From: Martin M on
Hello,

please take a look at this very simple program built up with VS2005 with the
form designer:
namespace TestHide
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
this.Hide ();
}
}
}
What happens when I click the button is that the form disappears but not
only from the desktop, also from the taskbar and also from the task manager |
applications tab. All that is left is that it is still in the task manager
processes tab. But there is no chance for me to get it back on the desktop.

I would have expected, that it would remain in the taskbar like when I click
the minimize button.

What did I do wrong or how can I achieve the desired function?

Thank you for any help

Martin
From: Alberto Poblacion on
"Martin M" <MartinM(a)discussions.microsoft.com> wrote in message
news:57EC567D-B625-4EFB-8641-70A2F212B7DF(a)microsoft.com...
> [...]
> this.Hide ();
> [...]
> What happens when I click the button is that the form disappears but not
> only from the desktop, also from the taskbar and also from the task
> manager |
> applications tab. All that is left is that it is still in the task manager
> processes tab. But there is no chance for me to get it back on the
> desktop.
>
> I would have expected, that it would remain in the taskbar like when I
> click
> the minimize button.
>
> What did I do wrong or how can I achieve the desired function?

The Hide method does the opposite of the Show method, in the sense that
it makes the form no longer visible. Since the taskbar shows by default the
forms that are visible, it no longer appears there. Normally, you would only
use this method on secondary Forms that have been opened from your main
form. The main form would have some UI element to show the secondary form
when needed.

To achieve the result that you are seeking (form not visible on screen,
but visible on the taskbar), what you need to do is _minimize_ the form.
This can be done in code by means of this.WindowState =
FormWindowState.Minimized.

From: Martin M on
Hi Alberto,

thnak you for your answer.

> This can be done in code by means of this.WindowState =
> FormWindowState.Minimized.

I tried this and got this error:
error CS0117: 'System.Windows.Forms.FormWindowState' does not contain a
definition for 'Minimized'
I also tried Maximized and Normal which compiled well.
Then I deleted .Miniminzed and reenter the dot to get the context menu
offering the possibilities and that only displayed Normal and Maximized.
Is this because it is a project for WinCE with Compact Framework 2.0

Any help is welcome

Thank you

Martin
From: Alberto Poblacion on
"Martin M" <MartinM(a)discussions.microsoft.com> wrote in message
news:D8F76F17-1BB4-44FC-BFA8-B43463D0F279(a)microsoft.com...
> error CS0117: 'System.Windows.Forms.FormWindowState' does not contain a
> definition for 'Minimized'
> I also tried Maximized and Normal which compiled well.
> Then I deleted .Miniminzed and reenter the dot to get the context menu
> offering the possibilities and that only displayed Normal and Maximized.
> Is this because it is a project for WinCE with Compact Framework 2.0

Ah, I thought that it was a standard Windows Forms project, where you
can minimize forms to the taskbar. I don't think that forms can me minimized
in Windows CE. Maybe someone else can suggest another alternative for this
environment.

From: Martin M on
Hi Alberto,

and thank you for your answer.
I wasn't aware about that difference either. I can minimize that form in Win
CE but only from the button on the title bar as we are used to in desktop Win.

I hope there will be some solution.

Martin