Click on the DBListBox, then you can display other data segments of the same RecNo number in the EDIT.

xiaoxiao2021-03-06  14

I am solved using this method // --------------------------------------- ----------------------------------

#include

#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 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;

}

}

/ / -------------------------------------------------------------------------------------------- ---------------------------

Back to top

转载请注明原文地址:https://www.9cbs.com/read-50366.html

New Post(0)