急!!!!高手快来呀

zhsh200 2003-05-25 02:41:48
如何对listview 中进行写数据????,如何从ListView中读数据????

我愿拿200分送上!!!
...全文
13 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhsh200 2003-05-26
  • 打赏
  • 举报
回复
搞定!谢谢大家!!!!!
baffling 2003-05-25
  • 打赏
  • 举报
回复
来晚了
蓝色光芒 2003-05-25
  • 打赏
  • 举报
回复
写数据:
With ListView1.Items.add do begin
Caption := '第一列';
Subitems.add('第二列');
Subitems.add('第三列');
Subitems.add('第四列');
//....
end;

取数据:
首先确定取哪行的。
如果是取Line行的内容:
Edit1.Text := ListView1.Items[Line].Caption //第一列
Edit2.Text := ListView1.Items[Line].Subitems.Strings[0]//第二列
Edit3.Text := ListView1.Items[Line].Subitems.Strings[1]//第二列
.....OK

haoco 2003-05-25
  • 打赏
  • 举报
回复
读取被选中的第一列:
ListView.Selected.caption
第二列:
ListView.Selected.SubItems[0]
第三列:
ListView.Selected.SubItems[1]
。。。。。。。。。。。。。。。
huojiehai 2003-05-25
  • 打赏
  • 举报
回复
试ComboBox1.Items[i].caption
ComboBox1.Items[i].substring.text
zhsh200 2003-05-25
  • 打赏
  • 举报
回复
当显示格式为Report时,我如何从ListView 中具体的读出,选中的某条记录的具体的字段内容??
whitetiger8 2003-05-25
  • 打赏
  • 举报
回复
被抢先了。
reedseutozte 2003-05-25
  • 打赏
  • 举报
回复
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
ListItem: TListItem;
NewColumn: TListColumn;
begin
// Create a ListView item for each image in the ImageList
with ListView1 do
begin
SmallImages := ImageList1;
LargeImages := ImageList1;
for I := 0 to ImageList1.Count - 1 do
begin
ListItem := Items.Add;
Listitem.Caption := 'Image' + IntToStr(I);

ListItem.ImageIndex := I;
end;
// Create two columns to show during viewing as vsReport
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 1';
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 2';
// Add View styles and constants to the Combo Box
ComboBox1.Items.AddObject('vsIcon', TObject(vsIcon));
ComboBox1.Items.AddObject('vsList', TObject(vsList));
ComboBox1.Items.AddObject('vsReport', TObject(vsReport));

ComboBox1.Items.AddObject('vsSmallIcon', TObject(vsSmallIcon));
// Display first item in the Combo Box
ComboBox1.ItemIndex := 0;
end;
end;

procedure TForm1.ComboBox1Click(Sender: TObject);
begin
with ComboBox1 do
ListView1.ViewStyle := TViewStyle(Items.Objects[ItemIndex]);
end;

5,388

社区成员

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

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