C#: How do you edit items and subitems in a listview?

后端 未结 5 407
失恋的感觉
失恋的感觉 2020-11-29 06:41

How do you edit items and subitems in a listview? Let\'s say I have a listview with 3 columns,and subitems,

Car Brand | Car Name | Car Year
Ford      | Mustang         


        
5条回答
  •  暖寄归人
    2020-11-29 07:09

    Click the items in the list view. Add a button that will edit the selected items. Add the code

    try
    {              
        LSTDEDUCTION.SelectedItems[0].SubItems[1].Text = txtcarName.Text;
        LSTDEDUCTION.SelectedItems[0].SubItems[0].Text = txtcarBrand.Text;
        LSTDEDUCTION.SelectedItems[0].SubItems[2].Text = txtCarName.Text;
    }
    catch{}
    

提交回复
热议问题