菜菜求救!!!!!!!

cwb210 2008-07-07 02:32:49
现在有3个已经做好的列头,第一个是产品,第二个的数量,第三个是价格,
都是在同一个listview控件上的,第一个列头做好了ListViewItem lvi = new ListViewItem();

lvi.Text = "qq";
listView.Items.Add(lvi);
listView.Items.Add("fff");
接下来想在第二个和第三个列头下也同样写如何第一个列头一样的信息不知道该怎么写啊?
...全文
105 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
baihe_591 2008-07-07
  • 打赏
  • 举报
回复

string[] strs = new string[3];
strs[0] = "000";
strs[1] = "aaa";
strs[2] = "eee";

this.listView1.Items.Add(new ListViewItem(strs));

cwb210 2008-07-07
  • 打赏
  • 举报
回复
就是也像这样,
ListViewItem lvi = new ListViewItem();

lvi.Text = "qq";
listView.Items.Add(lvi);
listView.Items.Add("fff");
cwb210 2008-07-07
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 baihe_591 的回复:]
C# codethis.listView1.Items.Add(newListViewItem(newstring[] {"0001","abc","eeee"}));
[/Quote]
谢谢大家,我想要的结果就是这样的,不过我想问下,能不能像我那样把后面的2个头写代码呢?
能的话该怎么写?或说说第二个头的表位置也成。。
520yunyuna 2008-07-07
  • 打赏
  • 举报
回复
帮顶!
卧_槽 2008-07-07
  • 打赏
  • 举报
回复
this.listView1.SubItems.AddRange(new string[](" 0001", "abc", "eeee"));
zhnzzy 2008-07-07
  • 打赏
  • 举报
回复

this.listView1.SubItems.AddRange(new string[](" 0001", "abc", "eeee"));
baihe_591 2008-07-07
  • 打赏
  • 举报
回复

this.listView1.Items.Add(new ListViewItem(new string[] { " 0001", "abc", "eeee" }));
xhan2000 2008-07-07
  • 打赏
  • 举报
回复
帮顶
ericzhangbo1982111 2008-07-07
  • 打赏
  • 举报
回复
不太明白你的意思
如果不同的话 在new一个ListViewItem就可以了
如果你想要
第一个是产品,第二个的数量,第三个是价格,

ListViewItem item= new ListViewItem();

itme.SubItems[0].Text = "产品";
itme.SubItems.Add("数量");
itme.SubItems.Add("价格");
listView.Items.Add(item);

item= new ListViewItem();

itme.SubItems[0].Text = "产品1";
itme.SubItems.Add("数量1");
itme.SubItems.Add("价格1");
listView.Items.Add(item);



111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧