473,218 Members | 1,796 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,218 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 2393
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.