K
K
KerroViT2020-08-14 19:31:41
C++ / C#
KerroViT, 2020-08-14 19:31:41

Why is only the last element in the loop displayed?

There is a code for obtaining information about a WIM file (I give a piece of work with a cycle) using the DISM API in a cycle and writing information to the DataGridView:

foreach(DismImageInfo imageInfo in imageInfos)
            {
                int i = 0;
                windows_images.Rows.Add();
                windows_images.Rows[i].Cells[0].Value = imageInfo.ImageIndex.ToString();
                windows_images.Rows[i].Cells[1].Value = imageInfo.ImageName.ToString();
                ++i;
            }

But in the DataGridView, only the last received record is displayed and in the first row, although the number of rows is created correctly. How to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
#
#, 2020-08-14
@KerroViT

so so so ... either .. int i = 0;put it in BEFORE the cycle .. or /upd*** sorry .. ))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question