无法在LIST中增加

无法在LIST中增加

本文介绍了无法在LIST中增加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一份清单。在我的列表中,我只有1条记录。我想在列表中添加增量计数器。如果用户输入5个值,则相同的记录将显示5次。



1印度

2印度

3印度

4印度

5印度





示例:IF值NdPlettes = 4.我的列表将显示4次。

如果NdPlettes的值= 5.我的列表将显示5次



现在我得到的结果如下:

5印度

5印度

5印度

5印度

5印度



我尝试过:



Hi Everyone,

I am having a list. In my list I have only 1 record.I want to add an increment counter in a list. If user enter 5 value the same recor will be display 5 times.

1 INDIA
2 INDIA
3 INDIA
4 INDIA
5 INDIA


Example: IF value of NdPlettes= 4. my list will display 4 times.
IF value of NdPlettes= 5. my list will display 5 times

now I am getting result like:
5 INDIA
5 INDIA
5 INDIA
5 INDIA
5 INDIA

What I have tried:

int index = 1;
               generateSeqNumber();
               foreach (var ProdSelection in ClientImpressionProdSelection)
               {
                   if (index <= InputProduct.NdPlettes)
                   {
                       ProdSelection.Sequence = Convert.ToInt32(GenResult);
                       ProdSelection.Number = index;
                       ProdSelection.ClientDestinataire = InputProduct.ClientDestinataire;
                       ProdSelection.LieuDeLivraison = InputProduct.LieuDeLivraison;
                       ProdSelection.CodeProduitClient = InputProduct.CodeProduitClient;
                       ProdSelection.CodeCouleurClient = InputProduct.CodeCouleurClient;
                       ProdSelection.CodeFournisseurEMPourClient = InputProduct.CodeFournisseurEMPourClient;
                       ProdSelection.AQP = InputProduct.AQP;
                       ProdSelection.Produit = InputProduct.Produit;
                       ProdSelection.RefFournisseur = InputProduct.RefFournisseur;
                       ProdSelection.NdShipment = InputProduct.NdShipment;
                       ProdSelection.NdLot = InputProduct.NdLot;
                       ProdSelection.Cdate = InputProduct.Cdate;
                       ProdSelection.PoidsNet = InputProduct.PoidsNet;
                       ProdSelection.PoidsBrut = InputProduct.PoidsBrut;
                       ProdSelection.NbrPallet = InputProduct.NdPlettes;
                       ProdSelection.Material = InputProduct.Material;
                       ProdSelection.CodClient = InputProduct.CodClient;
                       ProdSelection.CodPackaging = InputProduct.CodPackaging;
                       ProdSelection.CoefNetBrut = InputProduct.CoefNetBrut;
                       index++;
                       GetClientImpressionProductSel.Add(ProdSelection);
                   }

推荐答案

while (index <= InputProduct.NdPlettes)
{
   foreach (var ProdSelection in ClientImpressionProdSelection)
   {
       if (index++ > InputProduct.NdPlettes) break;
       ProdSelection.Sequence = Convert.ToInt32(GenResult);
       ProdSelection.Number = index;
       ProdSelection.ClientDestinataire = InputProduct.ClientDestinataire;
       ProdSelection.LieuDeLivraison = InputProduct.LieuDeLivraison;
       ProdSelection.CodeProduitClient = InputProduct.CodeProduitClient;
       ProdSelection.CodeCouleurClient = InputProduct.CodeCouleurClient;
       ProdSelection.CodeFournisseurEMPourClient = InputProduct.CodeFournisseurEMPourClient;
       ProdSelection.AQP = InputProduct.AQP;
       ProdSelection.Produit = InputProduct.Produit;
       ProdSelection.RefFournisseur = InputProduct.RefFournisseur;
       ProdSelection.NdShipment = InputProduct.NdShipment;
       ProdSelection.NdLot = InputProduct.NdLot;
       ProdSelection.Cdate = InputProduct.Cdate;
       ProdSelection.PoidsNet = InputProduct.PoidsNet;
       ProdSelection.PoidsBrut = InputProduct.PoidsBrut;
       ProdSelection.NbrPallet = InputProduct.NdPlettes;
       ProdSelection.Material = InputProduct.Material;
       ProdSelection.CodClient = InputProduct.CodClient;
       ProdSelection.CodPackaging = InputProduct.CodPackaging;
       ProdSelection.CoefNetBrut = InputProduct.CoefNetBrut;
       GetClientImpressionProductSel.Add(ProdSelection);
   }
}



这篇关于无法在LIST中增加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 18:21