<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Unable to dispose of AxToolbarControl in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-dispose-of-axtoolbarcontrol/m-p/724716#M19327</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my app, I have a toolbarcontrol, the table of contents control, and the map control.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason the toolbar control will not allow itself to be disposed of. I can set the reference to Nothing, but I cannot call dispose on it, and any attempt to do so throws the "InvalidOperationException" with the message...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cross-thread operation not valid: Control 'esriMapControl' accessed from a thread other than the thread it was created on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code is simply this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriToolbarControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriTOCControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriMapControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also not allowed to do this... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Runtime.InteropServices.Marshal.FinalReleaseComObject(esriToolbarControl.GetOcx)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea how to get around this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, the Table of contents control and map control can be disposed of just fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Jul 2010 16:41:49 GMT</pubDate>
    <dc:creator>ESRICustomer</dc:creator>
    <dc:date>2010-07-29T16:41:49Z</dc:date>
    <item>
      <title>Unable to dispose of AxToolbarControl</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-dispose-of-axtoolbarcontrol/m-p/724716#M19327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In my app, I have a toolbarcontrol, the table of contents control, and the map control.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason the toolbar control will not allow itself to be disposed of. I can set the reference to Nothing, but I cannot call dispose on it, and any attempt to do so throws the "InvalidOperationException" with the message...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cross-thread operation not valid: Control 'esriMapControl' accessed from a thread other than the thread it was created on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code is simply this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriToolbarControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriTOCControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Me.esriMapControl.Dispose()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am also not allowed to do this... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;System.Runtime.InteropServices.Marshal.FinalReleaseComObject(esriToolbarControl.GetOcx)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any idea how to get around this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;By the way, the Table of contents control and map control can be disposed of just fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 16:41:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-dispose-of-axtoolbarcontrol/m-p/724716#M19327</guid>
      <dc:creator>ESRICustomer</dc:creator>
      <dc:date>2010-07-29T16:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to dispose of AxToolbarControl</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-dispose-of-axtoolbarcontrol/m-p/724717#M19328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Nevermind, I found the problem.&amp;nbsp; Turns out you have to dispose of the map control BEFORE you dispose of the toolbar control.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Jul 2010 17:12:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unable-to-dispose-of-axtoolbarcontrol/m-p/724717#M19328</guid>
      <dc:creator>ESRICustomer</dc:creator>
      <dc:date>2010-07-29T17:12:59Z</dc:date>
    </item>
  </channel>
</rss>

