TListView赋值的问题。急,在线,马上给分

DelUser 2002-11-01 12:49:57
我现在有一个TListView有5个Columns.有8行。
现在我要对第二行的第三个Columns赋值不知道怎么做,请大家帮忙!
...全文
36 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chechy 2002-11-01
  • 打赏
  • 举报
回复
listview1.Selected.SubItems('No2 Col');
listview1.Selected.SubItems('No3 Col');
alphax 2002-11-01
  • 打赏
  • 举报
回复
你应该首先确保ListView1.Items[x].SubItems.Count > 2
否则,
你要用添加的方式,而不是赋值
if ListView1.Items[x].SubItems.Count = 0 then
begin
ListView1.Items[x].SubItems.Add(Col2Text);
ListView1.Items[x].SubItems.Add(Col3Text);
end
else if ListView1.Items[x].SubItems.Count = 1 then
begin
ListView1.Items[x].SubItems.Add(Col3Text);
end
DelUser 2002-11-01
  • 打赏
  • 举报
回复
to alphax() 你说的不是和 keenleung(Sword Master) 的一样吗?
抱的错也一样!
alphax 2002-11-01
  • 打赏
  • 举报
回复
如果你的第一列是唯一的话并且预先知道值的话,可以先调用ListView1.FindCaption查找一下需要的行。
alphax 2002-11-01
  • 打赏
  • 举报
回复
ListView1.Items[1{2行}].SubItems.Stings[1{第三列}] := 'aValue';
DelUser 2002-11-01
  • 打赏
  • 举报
回复
to chechy(为程序而奋斗) 四星上将
我只想改第三列的,你这样程序怎么知道改那个值?能再详细点吗?
to keenleung(Sword Master) 程序抱错
List Index of Bound(3)
能再想想吗?
keenleung 2002-11-01
  • 打赏
  • 举报
回复
ListView1.Items.Item[1].SubItems.Strings[1]:='...';

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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