Usercontrol destroyed ? (reference object becomes null?!)q
Hi
I Have a real strange problem here,
I create a ToolWindow of an UserControl like this
---------------------------------------------------------------
else if (connectMode == ext_ConnectMode.ext_cm_AfterStartup)
{
try
{
string guidString =
"{91EDB65F-4B6D-440E-8032-16FD874E0F6A}";
Windows2 windows2 = (Windows2)_applicationObject.
Windows;
Assembly asm = Assembly.GetExecutingAssembly();
toolWindow = (Window2)windows2.
CreateToolWindow2(_addInInstance, asm.Location,
"CommentAddin.IdlBrowser", "Idl Browser", guidString,
ref programmableObject);
// If tool window was created successfully, make it
visible
if (toolWindow != null)
{
toolWindow.Visible = true;
}
//toolWindow.SetTabPicture( ((System.Drawing.Bitmap)
(resources.GetObject("icon"))).GetHbitmap());
idlBrowser = programmableObject as IdlBrowser;
if (idlBrowser == null)
MessageBox.Show(" null");
tv = idlBrowser.treeView1;
MessageBox.Show(tv.Nodes[0].Text);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
}
-------------------------------------------------------------------
Well this works ! I have a treeView on my control ,
And the messageBox shows me the correct String.
Well I catch the WindowActivated event and
the idlBrowser object is null !! as long as I am in this slope everything
is fine , but after it the reference object
is null , how can this happen ?
Regrets ,
Jazz
url:http://www.ureader.com/gp/1545-1.aspx
date: Fri, 4 Jan 2008 00:44:51 +0800
author: Carsten