点击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;
}
}
//---------------------------------------------------------------------------
返回页首
#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;
}
}
//---------------------------------------------------------------------------
返回页首
相关文章推荐
- 汇编语言: 从键盘上输入一串字符(用回车键结束,使用10号功能调用。),将其中的小写英文 字母变换为大写英文字母,其他字符保持不变。然后将变换后的字符串显示出来。
- 关于安卓alertdialog你能用到的都在这里了(进出动画,显示位置,背景,设置内容,是否可以点击其他地方消失,屏幕不变暗)
- 点击其他checkbox,然后显示和隐藏区域
- android如果给TextView或EditText的email链接加下划线,并在点击在email连接上可以弹框显示
- 文本框里显示提示语言,点击可以输入其他内容
- 3. 定义10个字节的键盘缓冲区,然后键盘输入字符填满该缓冲区,做如下工作: (1)分别将输入键盘缓冲区的字符按数字,小写字母,大写字母,其他字符进行计数; 分别将这些计数值显示出来。 (2)分别将这
- IE8.0中显示不出来图片其他浏览器都可以显示
- 查看SharePoint文档库是,显示层次目录,可以点击返回层次
- VFP将图片或其他文件保存到SQL Server的Text类型字段或者Access的备注字段中,并可以还原或显示
- js如何实现点击一个按钮显示一个div,然后该div上有一个按钮,点击此按钮后隐藏,隐藏的同时显示另外一个div,而在次弹出的div也有一个按钮,点击后隐藏.
- javascript 案例,显示一些按钮,如果点击了,当前点击的按钮文本变为“点了”,其他按钮文本变为“没点”
- 点击按钮 可以显示隐藏
- 上传图片的问题,点击浏览选择图片后就可以在image框显示图片,不要再点击上传
- hbuider 中点击就显示出一个单选的列表 ,然后后台跨域向里面动态添加数据,注意里面的格式是json object
- android悬浮球,应用在所有软件之上,点击可以显示菜单
- 报表分组统计然后显示数据的时候顺序不正常,即使用order by 也是不可以!见图
- 02-Opencv 之打开一张图片,然后用鼠标切图然后显示出来
- 点击EditText 不显示光标 问题解决
- Android.EditText点击时,隐藏系统弹出的键盘,显示出光标
- android保存图片到本地并可以在相册中显示出来