如何将文本框中的值传递到C#中Windows应用程序中的listview单击按钮 [英] how to pass values from textbox into listview click buttons in windows application in C#
本文介绍了如何将文本框中的值传递到C#中Windows应用程序中的listview单击按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将文本框中的值传递到C#中的Windows应用程序中的listview单击按钮
how to pass values from textbox into listview click buttons in windows application in C#
推荐答案
假设您的ListView采用详细信息的形式,现在尝试这样:
Suppose ur ListView is in the form of Details, now try this:
ListViewItem itme = new ListViewItem();
itme.SubItems.Clear();
item.Text ="Your Value1";
itme.SubItems.Add("Your Sub Value1");
ListView1.Items.Add(itme);
试试这个希望对你有所帮助
try this hope its help you
private void button1_Click(object sender, EventArgs e)
{
ListViewItem li = new ListViewItem();
li.Text = textBox1.Text;
this.listView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {li
});
}
这篇关于如何将文本框中的值传递到C#中Windows应用程序中的listview单击按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文