<?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: Create loop to change name of combo boxes in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236435#M42826</link>
    <description>&lt;P&gt;Hi Keith,&lt;/P&gt;&lt;P&gt;Thanks for your reply. I am not sure if we have crossed wires here but...&lt;/P&gt;&lt;P&gt;I am not trying to change the names or properties of the combo boxes on the form, I want the loop to change which combo box it&amp;nbsp;calls in&amp;nbsp;each iteration. So I guess that each reference to a combo box should be a variable whose value changes on each pass...at the moment they are hard coded calls.&lt;/P&gt;&lt;P&gt;i.e&lt;/P&gt;&lt;P&gt;The snippet below shows what should be called on the&amp;nbsp;1st pass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(medialist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(stylelist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox3&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox3&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the&amp;nbsp;2nd&amp;nbsp;pass would need to be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox4&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox4&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(medilist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox5&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox5&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(stylelist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox6&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox6&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc. up until combobox12 is reached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: the&amp;nbsp;above is just an example to show what needs to change in the loop...&lt;/P&gt;&lt;P&gt;If I am missing your point I do apologise, but like I say I am still learning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
    <pubDate>Wed, 27 Aug 2014 10:54:18 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-08-27T10:54:18Z</dc:date>
    <item>
      <title>Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5234247#M42824</link>
      <description>&lt;P&gt;I am going thru the learning process with C# &amp;amp; .NET so I was wondering if anyone can help me out with this issue.&lt;/P&gt;&lt;P&gt;I have created a Windows Form which has 12 combo boxes (in rows of 3 numbered 1-12). On the Form_Load event I am trying to populate all the boxes with values obtained from the registry (previously set), please see sample below. At the moment it is written with the actual combo box names i.e. combobox1, combobox2 &amp;amp; combobox3 and does exactly what it should. However, I would like to wrap this in a loop that will run 4 times, changing the number of the Printer &amp;amp; each combo box accordingly. For example, on the 1st run we would have Printer1, combobox1, combobox2 &amp;amp; combobox3. The next run would then have Printer2, combobox4, combobox5 &amp;amp; combobox6...etc.&lt;/P&gt;&lt;P&gt;I am struggling to find a way to rename the comboboxes as they are not strings. Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private void Form1_Load(object sender, EventArgs e)&lt;BR /&gt;{&lt;BR /&gt;////for testing get the editor so we can write test strings to the command line&lt;BR /&gt;//Document doc =&lt;BR /&gt;// acadApp.DocumentManager.MdiActiveDocument;&lt;BR /&gt;//Editor ed = doc.Editor;&lt;BR /&gt;////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;//Make the cancel button default&lt;BR /&gt;this.ActiveControl = button6;&lt;BR /&gt;//Get the plot device list &amp;amp; make a collection of the names&lt;BR /&gt;PlotSettingsValidator psv = PlotSettingsValidator.Current;&lt;BR /&gt;StringCollection devlist = psv.GetPlotDeviceList();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;***START LOOP HERE***&lt;BR /&gt;//See if we have already reistered a device &amp;amp; if so set the combobox to that device&lt;BR /&gt;int printer = 1; //this is just me testing the following line...it should be set by the repeat loop&lt;BR /&gt;string regPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Ezcad\\EzQPlot\\Printer" + printer;&lt;BR /&gt;string name = (EzReg.EzRegGet.getRegentry(regPath, "Name").ToString());&lt;BR /&gt;string media = (EzReg.EzRegGet.getRegentry(regPath, "Media").ToString());&lt;BR /&gt;string style = (EzReg.EzRegGet.getRegentry(regPath, "Style").ToString());&lt;BR /&gt;if (devlist.Contains(name))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, comboBox1);&lt;BR /&gt;this.comboBox1.SelectedIndex = devlist.IndexOf(name);&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, comboBox1);&lt;BR /&gt;this.comboBox1.SelectedIndex = 1;&lt;BR /&gt;}&lt;BR /&gt;//Get the plot settings to access the media&lt;BR /&gt;PlotSettings ps = new PlotSettings(true);&lt;BR /&gt;using (ps)&lt;BR /&gt;{&lt;BR /&gt;// We should refresh the lists, in case setting the device impacts the available media&lt;BR /&gt;psv.SetPlotConfigurationName(ps, name, null);&lt;BR /&gt;psv.RefreshLists(ps);&lt;BR /&gt;StringCollection medlist = psv.GetCanonicalMediaNameList(ps);&lt;BR /&gt;for (int i = 0; i &amp;lt; medlist.Count; i++)&lt;BR /&gt;{&lt;BR /&gt;string localMedia = (psv.GetLocaleMediaName(ps, medlist[i]));&lt;BR /&gt;comboBox2.Items.Add(localMedia);&lt;BR /&gt;if (localMedia == media)&lt;BR /&gt;{&lt;BR /&gt;string conName = medlist[i];&lt;BR /&gt;this.comboBox2.SelectedIndex = medlist.IndexOf(conName);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;//Get style list&lt;BR /&gt;StringCollection styleList = psv.GetPlotStyleSheetList();&lt;BR /&gt;if (styleList.Contains(style))&lt;BR /&gt;{&lt;BR /&gt;Ez_Combo_Add.EzComboList.setCombo(styleList, comboBox3);&lt;BR /&gt;this.comboBox3.SelectedIndex = styleList.IndexOf(style);&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2014 12:23:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5234247#M42824</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-26T12:23:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5234437#M42825</link>
      <description>&lt;P&gt;You should look at the MSDN documentation for &lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form(v=vs.110).aspx" target="_blank"&gt;forms&lt;/A&gt;. &amp;nbsp;Scroll down until you see the &lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls(v=vs.110).aspx" target="_blank"&gt;controls&lt;/A&gt;&amp;nbsp;property. &amp;nbsp;This property will give you access to all of the controls on your form as a collection. &amp;nbsp;You can use it in a loop to access the controls that you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might also want to check out the &lt;A href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection(v=vs.110).aspx" target="_blank"&gt;Control.ControlCollection&lt;/A&gt;&amp;nbsp;class as you can use the documentation here to see how to access the control with its index or its name. &amp;nbsp;See the Item[Int32] property.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Aug 2014 13:38:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5234437#M42825</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2014-08-26T13:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236435#M42826</link>
      <description>&lt;P&gt;Hi Keith,&lt;/P&gt;&lt;P&gt;Thanks for your reply. I am not sure if we have crossed wires here but...&lt;/P&gt;&lt;P&gt;I am not trying to change the names or properties of the combo boxes on the form, I want the loop to change which combo box it&amp;nbsp;calls in&amp;nbsp;each iteration. So I guess that each reference to a combo box should be a variable whose value changes on each pass...at the moment they are hard coded calls.&lt;/P&gt;&lt;P&gt;i.e&lt;/P&gt;&lt;P&gt;The snippet below shows what should be called on the&amp;nbsp;1st pass.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox1&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(medialist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox2&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(stylelist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox3&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox3&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the&amp;nbsp;2nd&amp;nbsp;pass would need to be:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox4&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox4&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(medilist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox5&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox5&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;/P&gt;&lt;P&gt;Ez_Combo_Add.EzComboList.setCombo(stylelist, &lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox6&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;);&lt;BR /&gt;this.&lt;SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;comboBox6&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;.SelectedIndex = 1;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;etc. up until combobox12 is reached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: the&amp;nbsp;above is just an example to show what needs to change in the loop...&lt;/P&gt;&lt;P&gt;If I am missing your point I do apologise, but like I say I am still learning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2014 10:54:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236435#M42826</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-27T10:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236863#M42827</link>
      <description>&lt;P&gt;I think you misunderstood what I wrote. &amp;nbsp;If you go to the documentation in the links i provided you can see how to access the combobox by either its name or its index. &amp;nbsp;Lets assume you want to access it by its name. &amp;nbsp;If you have 12 comboboxes and are changing 3 each time through the loop then you will need 4 loops and one indexer for the name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you can create a loop that will index the combobox using a combination of its name and the index variable. &amp;nbsp;Psuedocode is below as I am doing this off the top of my head.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// psuedocode
int index = 1;
loop 4 times;
{
&amp;nbsp; &amp;nbsp; Ez_Combo_Add.EzComboList.setCombo(devlist, this.controls["comboBox" + Index.ToString]);
&amp;nbsp; &amp;nbsp; this.controls["comboBox" + Index.ToString].SelectedIndex=1;
&amp;nbsp; &amp;nbsp; index++
&amp;nbsp; &amp;nbsp; Ez_Combo_Add.EzComboList.setCombo(medialist,&amp;nbsp;this.controls["comboBox" + Index.ToString]);
&amp;nbsp; &amp;nbsp; this.controls["comboBox" + Index.ToString].SelectedIndex=1;
&amp;nbsp; &amp;nbsp; index++
&amp;nbsp; &amp;nbsp; Ez_Combo_Add.EzComboList.setCombo(stylelist,&amp;nbsp;this.controls["comboBox" + Index.ToString]);
&amp;nbsp; &amp;nbsp; this.controls["comboBox" + Index.ToString].SelectedIndex=1;
&amp;nbsp; &amp;nbsp; index++
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2014 13:51:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236863#M42827</guid>
      <dc:creator>Keith.Brown</dc:creator>
      <dc:date>2014-08-27T13:51:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236919#M42828</link>
      <description>&lt;P&gt;Thanks Keith,&lt;/P&gt;&lt;P&gt;I was kinda thinking along the lines you have shown but was struggling a little after this.Controls.&lt;/P&gt;&lt;P&gt;I will try implementing this later.&lt;/P&gt;&lt;P&gt;Thanks again,&amp;nbsp; Steve.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Aug 2014 14:05:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5236919#M42828</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-27T14:05:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create loop to change name of combo boxes</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5239175#M42829</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to implement your idea like so...casting the&amp;nbsp;control to a combobox for the helper function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//extract from Form_Load event&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ez_Combo_Add.EzComboList.setCombo(devlist, ((ComboBox)this.Controls["comboBox" + index.ToString()]));&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;((ComboBox)this.Controls["comboBox" + index.ToString()]).SelectedIndex = devlist.IndexOf(name);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;index++&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//function to add list to combobox&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; namespace Ez_Combo_Add&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class EzComboList&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static public void setCombo(StringCollection coll, ComboBox box)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string item in coll)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; box.Items.Add(item);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But on&amp;nbsp;execution it produces the same error for both lines: "Object reference not set to an instance of an object"&lt;/P&gt;&lt;P&gt;I am sorry for being such a pain but I am lost at the moment.&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2014 10:47:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-loop-to-change-name-of-combo-boxes/m-p/5239175#M42829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-08-28T10:47:13Z</dc:date>
    </item>
  </channel>
</rss>

