Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Fri, 4 Jan 2008 00:44:51 +0800,    group: microsoft.public.vstudio.extensibility        back       


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

Re:Usercontrol destroyed ? (reference object becomes null?!)q   
Hi

I solved it myself,
I just needed to set my memebers to static ...

Greetz

url:http://www.ureader.com/msg/15451144.aspx
date: Fri, 4 Jan 2008 23:08:04 +0800   author:   Carsten

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us