For new method in the loop

for (int parent = 0; parent <dsMain.Tables[0].Rows.Count; parent++)
            {
                string parentID = dsMain.Tables[0].Rows[parent]["ID"].ToString();
                string modulenameParent = dsMain.Tables[0].Rows[parent]["ModuleName"].ToString();
                Common.Widget.ComboBoxListItem itemParent = new Common.Widget.ComboBoxListItem(parentID, modulenameParent);
                this.cmbModuleName.Items.Add(itemParent);
            }


May I Common.Widget.ComboBoxListItem itemParent here there is no way and variables.?
Is similar to the itemParent+parent effect?

Started by Matthew at November 16, 2016 - 7:09 PM

May I Common.Widget.ComboBoxListItem itemParent here there is no way and variables.?

Don't know what you are?
The itemParent variable is Common.Widget.ComboBoxListItem

In the loop must be new, otherwise it will be the same object, i.e. how many cycles, the results are the same object.

Posted by Duncan at November 22, 2016 - 7:48 PM

int count=dsMain.Tables[0].Rows.Count;
Common.Widget.ComboBoxListItem[] itemParent=new Common.Widget.ComboBoxListItem[count];
for (int parent = 0; parent <count; parent++)
            {
                string parentID = dsMain.Tables[0].Rows[parent]["ID"].ToString();
                string modulenameParent = dsMain.Tables[0].Rows[parent]["ModuleName"].ToString();
                 itemParent[parent] = new Common.Widget.ComboBoxListItem(parentID, modulenameParent);
                this.cmbModuleName.Items.Add(itemParent[parent]);
            }

Do not know can you.

Posted by Matilda at November 28, 2016 - 8:02 PM