您的位置:首页 > 其它

点击DBLISTBOX的一项,然后可以在EDIT中把同一RECNO号的其他数据段显示出来

2005-03-05 23:01 429 查看
我用这种方法解决了//---------------------------------------------------------------------------

#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::FormCreate(TObject *Sender)
{
Table1->First();
for(int i=0;i<Table1->RecordCount;i++)
{ ListBox1->Items->Add(Table1->FieldByName("Name")->AsString);
Table1->Next();
}

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

void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
Table1->First();
AnsiString a;
a=Table1->FieldByName("Name")->AsString;
for(int i=ListBox1->Items->Count-1;i>=0;i--)
{

if(ListBox1->Items->Strings[ListBox1->ItemIndex]==a )
Edit1->Text=Table1->FieldByName("Desc")->AsString;

Table1->Next();
a=Table1->FieldByName("Name")->AsString;

}

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

返回页首
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  table
相关文章推荐