Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread binding edit component to dataset
Sat, Mar 5 2016 5:42 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

I want to bind all edit fields on a form to a dataset on another form.

Instead of using this  - (this is working correct):

edit1.dataset:=form1.L_Gebruikers;
edit2.dataset:=form1.L_Gebruikers;
......

But in order to not forget an edit field I would like to use the following:

for i := 0 to FrmMijnGegevens.ComponentCount - 1 do
   begin
   if (Component[i] is TEdit) then
      begin
      Component[i].DataSet:=form1.L_Gebruikers;
      end;
   end;


See error herby enclosed.

Paul.



Attachments: Error.jpg
Sat, Mar 5 2016 11:37 AMPermanent Link

squiffy

Telemix Ltd.

Avatar


I think you have to cast to make the assignment :
      TEdit(Component[i]).DataSet:=form1.L_Gebruikers;

(not tested).
Sun, Mar 6 2016 9:07 AMPermanent Link

Paul Waegemans

IMS bvba

Avatar

That's it !  Thanks.


squiffy wrote:


I think you have to cast to make the assignment :
      TEdit(Component[i]).DataSet:=form1.L_Gebruikers;

(not tested).
Image