怎么读取ListView中的数据?

liangbaiou 2005-04-22 07:44:03
将读取的数据放在一个二维数组中
...全文
107 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
tototo163 2005-04-22
  • 打赏
  • 举报
回复
这个是偶写的访问ListView
#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
TListItem *item;
item=ListView1->Items->Add();
item->Caption="ddd";
item->SubItems->Add("222");
item->SubItems->Add("333");
item->SubItems->Add("444");
item->SubItems->Add("555");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
TListItem *item=ListView1->Items->Item[0];
Edit1->Text = item->Caption;

String str =item->SubItems->Strings[2];
Edit2->Text=str;

}
//---------------------------------------------------------------------------

marchily 2005-04-22
  • 打赏
  • 举报
回复
用一个循环啊
for(i=0;i<listview的个数(有个专门的属性,忘了你自己找找);i++)
{
AnsiString a=Listview1->column->items->item[i]->caption;
//大概这样吧,具体的属性什么的我忘了!你自己在看看属性吧!
}

602

社区成员

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

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