Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一些帮助来将文本添加到具有四列的列表视图中。将文本添加到列表视图的一种方法是这样的:
var item1 = new ListViewItem(new[] {"text1", "text2", "text3", "text4"}); lvRegAnimals.Items.Add(item1);
但是我想知道当用户单击按钮以向所有列添加新内容时,这将如何在运行时完成?我是新手,我很感激一些帮助。谢谢!
将您的代码添加到按钮单击事件处理程序中,例如这样
void Btn_Click(Object sender,EventArgs e) { var item1 = new ListViewItem(new[] {"text1", "text2", "text3", "text4"}); lvRegAnimals.Items.Add(item1); }