1

I need create one item in my ToolStripMenuItem with this feature: if I check it, in application is turn on "stay on top" property.

I tryed this code:

private void alwaysOnTopToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
    {
        if (alwaysOnTopToolStripMenuItem.Checked)
            fForm1.TopMost = true;
        else
        {
            fForm1.TopMost = false;
        }
    }

but I get this error in Visual Studio 2010 (Windows Form)

enter image description here

I dont know how I can solve this strage issue. Thanks in advance.

Sam Axe
  • 33,313
  • 9
  • 55
  • 89
Vincenzo Lo Palo
  • 1,341
  • 5
  • 19
  • 32

1 Answers1

2

assuming the click handler lives in the form:

this.TopMost = alwaysOnTopToolStripMenuItem.Checked;
Sam Axe
  • 33,313
  • 9
  • 55
  • 89