473,386 Members | 1,821 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,386 software developers and data experts.

re-parenting a user control causes tooltips to remember original form

I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat" the
user control by reparenting it on a split container in another form.
Problem is if I wake a tooltip when the window is floated, and then try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.

Presumably, this is a result of the tooltips still keeping a reference
to the original form (container).

I know that tooltips have to be found using reflection and the controls
IContainer, but I am not sure how to go about this.

Is there a way to "reorient" all the tooltips to the new container?

Jan 3 '07 #1
9 2406
Hi,

To "unhook" a tooltip from a control call:

tooltip.SetToolTip(control, string.Empty);

To add it back:

tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it back
when you create it again.

Regards,
Valentin Ivanov

On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat" the
user control by reparenting it on a split container in another form.
Problem is if I wake a tooltip when the window is floated, and then try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.

Presumably, this is a result of the tooltips still keeping a reference
to the original form (container).

I know that tooltips have to be found using reflection and the controls
IContainer, but I am not sure how to go about this.

Is there a way to "reorient" all the tooltips to the new container?
Jan 3 '07 #2
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,

To "unhook" a tooltip from a control call:

tooltip.SetToolTip(control, string.Empty);

To add it back:

tooltip.SetToolTip(control, "Your tooltip text");

You have to remove tooltip before you destroy the form and add it back
when you create it again.

Regards,
Valentin Ivanov

On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat" the
user control by reparenting it on a split container in another form.
Problem is if I wake a tooltip when the window is floated, and then try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a reference
to the original form (container).
I know that tooltips have to be found using reflection and the controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new container?
Jan 3 '07 #3
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.

ti*****@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,

To "unhook" a tooltip from a control call:

tooltip.SetToolTip(control, string.Empty);

To add it back:

tooltip.SetToolTip(control, "Your tooltip text");

You have to remove tooltip before you destroy the form and add it back
when you create it again.

Regards,
Valentin Ivanov

On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat" the
user control by reparenting it on a split container in another form.
Problem is if I wake a tooltip when the window is floated, and then try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a reference
to the original form (container).
I know that tooltips have to be found using reflection and the controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new container?
Jan 3 '07 #4
Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now hover
over the menu item on the new form.... boom exception

--------- CUT HERE ----

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}

void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);

Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}

void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}

On Jan 3, 11:31 am, timn...@gmail.com wrote:
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.

timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,
To "unhook" a tooltip from a control call:
tooltip.SetToolTip(control, string.Empty);
To add it back:
tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it back
when you create it again.
Regards,
Valentin Ivanov
On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat" the
user control by reparenting it on a split container in another form.
Problem is if I wake a tooltip when the window is floated, and then try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a reference
to the original form (container).
I know that tooltips have to be found using reflection and the controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new container?
Jan 3 '07 #5
Hi,

The example doesn't show the problem because you are closing main form
before showing the second form which will lead to application end.
But even in this example tooltip is not tied to a form so it should be fine
to move panel around.

You can try it by commenting "Close();" call.

Regards,
Valentin Ivanov.

<ti*****@gmail.comwrote in message
news:11**********************@a3g2000cwd.googlegro ups.com...
Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now hover
over the menu item on the new form.... boom exception

--------- CUT HERE ----

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}

void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);

Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}

void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}

On Jan 3, 11:31 am, timn...@gmail.com wrote:
>BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.

timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,
To "unhook" a tooltip from a control call:
tooltip.SetToolTip(control, string.Empty);
To add it back:
tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it
back
when you create it again.
Regards,
Valentin Ivanov
On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat"
the
user control by reparenting it on a split container in another
form.
Problem is if I wake a tooltip when the window is floated, and then
try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a
reference
to the original form (container).
I know that tooltips have to be found using reflection and the
controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new container?
Jan 3 '07 #6
I beg to differ. The start up form is "InitialForm" it never gets
closed. I ran this and it reproduces the error.

On Jan 3, 2:45 pm, "Architect" <valen.iva...@gmail.comwrote:
Hi,

The example doesn't show the problem because you are closing main form
before showing the second form which will lead to application end.
But even in this example tooltip is not tied to a form so it should be fine
to move panel around.

You can try it by commenting "Close();" call.

Regards,
Valentin Ivanov.

<timn...@gmail.comwrote in messagenews:11**********************@a3g2000cwd.go oglegroups.com...
Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now hover
over the menu item on the new form.... boom exception
--------- CUT HERE ----
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}
void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);
Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}
void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}
On Jan 3, 11:31 am, timn...@gmail.com wrote:
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.
timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,
To "unhook" a tooltip from a control call:
tooltip.SetToolTip(control, string.Empty);
To add it back:
tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it
back
when you create it again.
Regards,
Valentin Ivanov
On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched into a
floating form. At some point later, I allow the user to "unfloat"
the
user control by reparenting it on a split container in another
form.
Problem is if I wake a tooltip when the window is floated, and then
try
the same thing when it is reparented, the app crashes with " Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a
reference
to the original form (container).
I know that tooltips have to be found using reflection and the
controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new container?
Jan 4 '07 #7
Yes, you right. I was modifying my existing sandbox solution and used
"MyForm" in the Application.Run call.
Anyways I was able to reproduce the issue. In my case it gives me:

FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the error
was at 0x7f4bb7a3, on thread 0x1f94. The error code is 0xc0000005. This
error may be a bug in the CLR or in the unsafe or non-verifiable portions of
user code. Common sources of this bug include user marshaling errors for
COM-interop or PInvoke, which may corrupt the stack.
I would say that it is a real bug in the CLR. I would report it to
Microsoft.
Meanwhile I'll try to help you and look if there is a workaround.

Regards,
Valentin Ivanov.
<ti*****@gmail.comwrote in message
news:11**********************@42g2000cwt.googlegro ups.com...
>I beg to differ. The start up form is "InitialForm" it never gets
closed. I ran this and it reproduces the error.

On Jan 3, 2:45 pm, "Architect" <valen.iva...@gmail.comwrote:
>Hi,

The example doesn't show the problem because you are closing main form
before showing the second form which will lead to application end.
But even in this example tooltip is not tied to a form so it should be
fine
to move panel around.

You can try it by commenting "Close();" call.

Regards,
Valentin Ivanov.

<timn...@gmail.comwrote in
messagenews:11**********************@a3g2000cwd.g ooglegroups.com...
Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now hover
over the menu item on the new form.... boom exception
--------- CUT HERE ----
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}
void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);
Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}
void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}
On Jan 3, 11:31 am, timn...@gmail.com wrote:
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.
>timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,
To "unhook" a tooltip from a control call:
tooltip.SetToolTip(control, string.Empty);
To add it back:
tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it
back
when you create it again.
Regards,
Valentin Ivanov
On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched
into a
floating form. At some point later, I allow the user to
"unfloat"
the
user control by reparenting it on a split container in another
form.
Problem is if I wake a tooltip when the window is floated, and
then
try
the same thing when it is reparented, the app crashes with "
Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a
reference
to the original form (container).
I know that tooltips have to be found using reflection and the
controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new
container?
Jan 5 '07 #8
Ok,

The problem lies in the ToolStrip control (too bad we don't have access to
the tooltip).
The only way to solve it is to recreate toolstrip.

Add a method to you user control which will
1. remove existing toolstrip
2. create new toolstrip
3. readd all items to the new toolstrip
4. add new toolstrip

Call that method each time you transfer your user control.

Regards,
Valentin Ivanov.

"Architect" <va**********@gmail.comwrote in message
news:F9**********************************@microsof t.com...
Yes, you right. I was modifying my existing sandbox solution and used
"MyForm" in the Application.Run call.
Anyways I was able to reproduce the issue. In my case it gives me:

FatalExecutionEngineError was detected
Message: The runtime has encountered a fatal error. The address of the
error was at 0x7f4bb7a3, on thread 0x1f94. The error code is 0xc0000005.
This error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code. Common sources of this bug include user marshaling
errors for COM-interop or PInvoke, which may corrupt the stack.
I would say that it is a real bug in the CLR. I would report it to
Microsoft.
Meanwhile I'll try to help you and look if there is a workaround.

Regards,
Valentin Ivanov.
<ti*****@gmail.comwrote in message
news:11**********************@42g2000cwt.googlegro ups.com...
>>I beg to differ. The start up form is "InitialForm" it never gets
closed. I ran this and it reproduces the error.

On Jan 3, 2:45 pm, "Architect" <valen.iva...@gmail.comwrote:
>>Hi,

The example doesn't show the problem because you are closing main form
before showing the second form which will lead to application end.
But even in this example tooltip is not tied to a form so it should be
fine
to move panel around.

You can try it by commenting "Close();" call.

Regards,
Valentin Ivanov.

<timn...@gmail.comwrote in
messagenews:11**********************@a3g2000cwd. googlegroups.com...

Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now
hover
over the menu item on the new form.... boom exception

--------- CUT HERE ----

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}

void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);

Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}

void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}

On Jan 3, 11:31 am, timn...@gmail.com wrote:
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.

timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to
the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.

On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,

To "unhook" a tooltip from a control call:

tooltip.SetToolTip(control, string.Empty);

To add it back:

tooltip.SetToolTip(control, "Your tooltip text");

You have to remove tooltip before you destroy the form and add it
back
when you create it again.

Regards,
Valentin Ivanov

On Jan 3, 9:08 am, timn...@gmail.com wrote:

I have an issue where I have a user control that is launched
into a
floating form. At some point later, I allow the user to
"unfloat"
the
user control by reparenting it on a split container in another
form.
Problem is if I wake a tooltip when the window is floated, and
then
try
the same thing when it is reparented, the app crashes with "
Cannot
access a disposed object.Object name: 'Form'.

Presumably, this is a result of the tooltips still keeping a
reference
to the original form (container).

I know that tooltips have to be found using reflection and the
controls
IContainer, but I am not sure how to go about this.

Is there a way to "reorient" all the tooltips to the new
container?
Jan 5 '07 #9
Hmm, for some reason my last reply is not here.

Anyways. The only way I made it to work is by recreating toolstrip control
each time I "migrate" the panel.

Regards,
Valentin Ivanov.

<ti*****@gmail.comwrote in message
news:11**********************@42g2000cwt.googlegro ups.com...
>I beg to differ. The start up form is "InitialForm" it never gets
closed. I ran this and it reproduces the error.

On Jan 3, 2:45 pm, "Architect" <valen.iva...@gmail.comwrote:
>Hi,

The example doesn't show the problem because you are closing main form
before showing the second form which will lead to application end.
But even in this example tooltip is not tied to a form so it should be
fine
to move panel around.

You can try it by commenting "Close();" call.

Regards,
Valentin Ivanov.

<timn...@gmail.comwrote in
messagenews:11**********************@a3g2000cwd.g ooglegroups.com...
Smallest example of issue below. Click the "open" button, hover over
the menu item to see the tool tip, click the "copy" button... now hover
over the menu item on the new form.... boom exception
--------- CUT HERE ----
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ToolTipIssue
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
Application.Run(new InitialForm());
}
}
public class InitialForm : Form
{
public InitialForm()
{
Button b = new Button();
b.Text = "Open Form";
Controls.Add(b);
b.Click += new EventHandler(b_Click);
}
void b_Click(object sender, EventArgs e)
{
MyForm f = new MyForm();
f.Show();
}
}
public class MyForm : Form
{
Panel p;
public MyForm()
{
p = new Panel();
ToolStrip t = new ToolStrip();
ToolStripButton b = new ToolStripButton();
b.Text = "Hello";
b.ToolTipText = "Hello ToolTip";
t.Items.Add(b);
p.BorderStyle = BorderStyle.Fixed3D;
p.Controls.Add(t);
Controls.Add(p);
Button bt = new Button();
bt.Text = "Copy";
bt.Click += new EventHandler(b_Click);
bt.Location = new System.Drawing.Point(0, 100);
Controls.Add(bt);
}
void b_Click(object sender, EventArgs e)
{
Form f = new Form();
f.Controls.Add(p);
Close();
f.Show();
}
}
}
On Jan 3, 11:31 am, timn...@gmail.com wrote:
BTW... the ToolTip is on a ToolStripItem and it seems to hold a
reference to the old form.
>timn...@gmail.com wrote:
Nope. I don't have a handle to the tooltip. I have a handle to the
form. I need to iterate the controls and their components and find
(using reflection since components are a private variable) the tool
tips.
On Jan 3, 9:38 am, "Architect" <Valen.Iva...@gmail.comwrote:
Hi,
To "unhook" a tooltip from a control call:
tooltip.SetToolTip(control, string.Empty);
To add it back:
tooltip.SetToolTip(control, "Your tooltip text");
You have to remove tooltip before you destroy the form and add it
back
when you create it again.
Regards,
Valentin Ivanov
On Jan 3, 9:08 am, timn...@gmail.com wrote:
I have an issue where I have a user control that is launched
into a
floating form. At some point later, I allow the user to
"unfloat"
the
user control by reparenting it on a split container in another
form.
Problem is if I wake a tooltip when the window is floated, and
then
try
the same thing when it is reparented, the app crashes with "
Cannot
access a disposed object.Object name: 'Form'.
Presumably, this is a result of the tooltips still keeping a
reference
to the original form (container).
I know that tooltips have to be found using reflection and the
controls
IContainer, but I am not sure how to go about this.
Is there a way to "reorient" all the tooltips to the new
container?
Jan 8 '07 #10

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

Similar topics

1
by: Nel | last post by:
I have a question related to the "security" issues posed by Globals ON. It is good programming technique IMO to initialise variables, even if it's just $foo = 0; $bar = ""; Surely it would...
4
by: Craig Bailey | last post by:
Anyone recommend a good script editor for Mac OS X? Just finished a 4-day PHP class in front of a Windows machine, and liked the editor we used. Don't recall the name, but it gave line numbers as...
1
by: Chris | last post by:
Sorry to post so much code all at once but I'm banging my head against the wall trying to get this to work! Does anyone have any idea where I'm going wrong? Thanks in advance and sorry again...
4
by: Alan Walkington | last post by:
Folks: How can I get an /exec'ed/ process to run in the background on an XP box? I have a monitor-like process which I am starting as 'exec("something.exe");' and, of course the exec function...
1
by: John Ryan | last post by:
What PHP code would I use to check if submitted sites to my directory actually exist?? I want to use something that can return the server code to me, ie HTTP 300 OK, or whatever. Can I do this with...
10
by: James | last post by:
What is the best method for creating a Web Page that uses both PHP and HTML ? <HTML> BLA BLA BLA BLA BLA
8
by: Lothar Scholz | last post by:
Because PHP5 does not include the mysql extension any more is there a chance that we will see more Providers offering webspace with Firebird or Postgres Databases ? What is your opinion ? I must...
1
by: joost | last post by:
Hello, I'm kind of new to mySQL but more used to Sybase/PHP What is illegal about this query or can i not use combined query's in mySQL? DELETE FROM manufacturers WHERE manufacturers_id ...
3
by: presspley | last post by:
I have bought the book on advanced dreamweaver and PHP recently. I have installed MySQL and PHP server but am getting an error on the $GET statement show below. It says there is a problem with...
1
by: Clarice Almeida Hughes | last post by:
tenho um index onde tenho o link pro arq css, como sao visualizados pelo include todas as paginas aderem ao css linkado no index. so q eu preciso de alguns links com outras cores no css, o q devo...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.