<?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 Re: C# Update Combobox when new drawing opens in the same session in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6974306#M32178</link>
    <description>&lt;P&gt;Yes that looks to be exactly what I need to learn, thanks a lot for your replies guys!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 26 Mar 2017 22:28:00 GMT</pubDate>
    <dc:creator>GrahamB8</dc:creator>
    <dc:date>2017-03-26T22:28:00Z</dc:date>
    <item>
      <title>C# Update Combobox when new drawing opens in the same session</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969841#M32174</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm in the middle of developing an application that reads the projectname variable in a drawing and checks&amp;nbsp;the value from the items within a combobox.&lt;/P&gt;&lt;P&gt;This works fine when I start the appliction&amp;nbsp;but If I open a new drawing from within the same session of AutoCAD I cant figure out how to get the item to automatically change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;            string currProject = GlobalVariables.currProject;
            comboBox1.SelectedIndex = comboBox1.FindStringExact(currProject);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand that I need a new method but I dont want to use&amp;nbsp;a button click or other user interaction how do I have the value of the combobox update when the user opens a new drawing or starts a new drawing from the same session of AutoCAD?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Graham&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 06:37:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969841#M32174</guid>
      <dc:creator>GrahamB8</dc:creator>
      <dc:date>2017-03-24T06:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: C# Update Combobox when new drawing opens in the same session</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969921#M32175</link>
      <description>&lt;P&gt;Graham,&lt;/P&gt;
&lt;P&gt;Do you know how to use Events?&lt;/P&gt;
&lt;P&gt;The Document Created event might be the one you're looking for, like the pseudo sample below.&lt;/P&gt;
&lt;P&gt;You also might use the Document BecameCurrent or Document Activated events in order to set the current ProjectNr equal to the one that belongs to the current drawing&lt;/P&gt;
&lt;P&gt;See attached screenshot where the Palette Label contents gets updated when switching Active documents.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;public class AppMgr : IExtensionApplication&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; void IExtensionApplication.Initialize()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Application.DocumentManager.DocumentCreated += DM_DocumentCreated;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;void _bacAcadDocs_DocumentCreated(object sender, DocumentCollectionEventArgs e)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //if Combo is visible&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp; Populate youre Combo&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 07:44:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969921#M32175</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-03-24T07:44:22Z</dc:date>
    </item>
    <item>
      <title>Re : C# Update Combobox when new drawing opens in the same session</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969933#M32176</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about handling DocumentCollection.DocumentActivated event.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/846050"&gt;@SENL1362&lt;/a&gt; replied while I was typing.&lt;/P&gt;
&lt;P&gt;I think DocumentActivated is a better way because it fires both when a new document is created and when the user switch from an opened document to another one.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 07:53:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969933#M32176</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2017-03-24T07:53:21Z</dc:date>
    </item>
    <item>
      <title>Re : C# Update Combobox when new drawing opens in the same session</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969943#M32177</link>
      <description>Agree, that's why my reference count for the Created Event==0 &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 24 Mar 2017 07:57:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6969943#M32177</guid>
      <dc:creator>SENL1362</dc:creator>
      <dc:date>2017-03-24T07:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: C# Update Combobox when new drawing opens in the same session</title>
      <link>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6974306#M32178</link>
      <description>&lt;P&gt;Yes that looks to be exactly what I need to learn, thanks a lot for your replies guys!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 22:28:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/c-update-combobox-when-new-drawing-opens-in-the-same-session/m-p/6974306#M32178</guid>
      <dc:creator>GrahamB8</dc:creator>
      <dc:date>2017-03-26T22:28:00Z</dc:date>
    </item>
  </channel>
</rss>

