<?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 Addin - Forms in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/addin-forms/m-p/9572046#M111897</link>
    <description>&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whats the general cencus on how forms are managed for an addin? Im having issue getting the right. Originally i declared my form in AddinGlobal as a New form but thats not right as it should be instantiated until needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public MyForm As New MyMainForm&lt;/LI-CODE&gt;&lt;P&gt;So, i changed it to a declare and instantiated in under the button click&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'in AddinGlobal
Public MyForm As MyMainForm

'in button click
AddinGlobal.MyForm = New MyMainForm&lt;/LI-CODE&gt;&lt;P&gt;But im getting issues as i have sime other forms that get added to my main form that require access to properties and functions of the Mainform. however because it hasnt been instantiated, i get a bunch of errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are other people doing to load forms in their addins?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jun 2020 14:17:35 GMT</pubDate>
    <dc:creator>NachitoMax</dc:creator>
    <dc:date>2020-06-10T14:17:35Z</dc:date>
    <item>
      <title>Addin - Forms</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/addin-forms/m-p/9572046#M111897</link>
      <description>&lt;P&gt;Hey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Whats the general cencus on how forms are managed for an addin? Im having issue getting the right. Originally i declared my form in AddinGlobal as a New form but thats not right as it should be instantiated until needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public MyForm As New MyMainForm&lt;/LI-CODE&gt;&lt;P&gt;So, i changed it to a declare and instantiated in under the button click&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'in AddinGlobal
Public MyForm As MyMainForm

'in button click
AddinGlobal.MyForm = New MyMainForm&lt;/LI-CODE&gt;&lt;P&gt;But im getting issues as i have sime other forms that get added to my main form that require access to properties and functions of the Mainform. however because it hasnt been instantiated, i get a bunch of errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are other people doing to load forms in their addins?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jun 2020 14:17:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/addin-forms/m-p/9572046#M111897</guid>
      <dc:creator>NachitoMax</dc:creator>
      <dc:date>2020-06-10T14:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: Addin - Forms</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/addin-forms/m-p/9580293#M112038</link>
      <description>&lt;P&gt;You need to separate your model (data structure) from your logic and from your view (your form)&lt;BR /&gt;&lt;BR /&gt;Example (C#) :&lt;BR /&gt;&lt;BR /&gt;public class Model()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; public string property (get; set;)&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public class ViewModel()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; public BindingList&amp;lt;Model&amp;gt; myBindingList = new BindingList&amp;lt;Model&amp;gt;();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; myBindingList.add( new Model&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; property = "this property",&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; });&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;public partial class View : Form&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; public View(BindingList&amp;lt;Model&amp;gt; bindingList)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Let say you have set a DataGridView in your Form Designer&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitializeComponent();&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; BindingSource bindingSource = new BindingSource(bindingList, "")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataGridView1.DataSource = BindingSource;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your ViewModel Class, you can subscribe your events and do all your logics. You should place as little code as possible in your forms.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a way, You should try to setup a &lt;A href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel" target="_blank" rel="noopener"&gt;MVVM&lt;/A&gt; structure you would do in a WPF form.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way, you never have properties and method in a form.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jun 2020 14:18:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/addin-forms/m-p/9580293#M112038</guid>
      <dc:creator>yan.gauthier</dc:creator>
      <dc:date>2020-06-15T14:18:47Z</dc:date>
    </item>
  </channel>
</rss>

