c#listview内容查询与修改内容

 

string scale_value="200";
string lotMoveInTime="2022/5/16 8:20";
listview2.SubItems[3].Text = scale_value; //索引是0开始,所有查到某一行后,修改第4列的数据
                    listview2.SubItems[4].Text = lotMoveInTime;
//索引是0开始,所有查到某一行后,修改第5列的日期数据
  private void AddInfoToListView_Scale(string lotID, string box_sn, string scale_value, string lotMoveInTime)
        // private void AddInfoToMainInterfaceListView(object str)
        //序号,标签SN,重量,时间
        {
            ListViewItem listview2 = new ListViewItem();
            listView_scale.Invoke(new Action(()=> {
                 listview2 = listView_scale.FindItemWithText(box_sn);
                if (listview2 != null)
                {
                    listview2.SubItems[3].Text = scale_value;
                    listview2.SubItems[4].Text = lotMoveInTime;

                }

            }));
            if(listview2!=null)
            {
                return;
            }

 

posted @ 2022-05-16 18:45  txwtech  阅读(1481)  评论(0编辑  收藏  举报