Text Boxes!

HI!

I am currently working on project where i have to create, requested by user number of EditBoxes! And after user enters values in those boxes and presess button, all these values from editboxes should be stored in array!
Any Ideas.
Thanx!
TPAKTOPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fatman121898Commented:
Hi TPAKTOP,

Which is the problem: creating EditBox or storing it's content in array?
(Ru or Bg?)

Jo.
0
TPAKTOPAuthor Commented:
Actually i would like to get an answer for both. However storing contents is more important!
Thanx!
0
DrDelphiCommented:
///first create the editboxes:

var editArray:array [0..9] of TEdit;
For x:=0 to 9 do
begin
  EditArray[x]:=Tedit.create(self);
  With EditArray[x] do
  begin
    Top:=x*5;
    Left:=10;
    Parent:=self;///this is crucial!
    height:=20;
  end;
end;


/// now store the contents

Var EditList:Tstringlist;
begin
  EditList:=Tstringlist.create;  
  For X:=0 to 9 do
  begin
    EditList.Items.Add(editArray[x].text);
    EditArray[x].text:=''; ///clear the editbox
   end;
end;


Good luck!!



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Fatman121898Commented:
Hey Doc,

You got me on the turn.
I should answer the same way.
;-)

Jo.
0
nricoCommented:
I guess it would be better to use a linked list, so can have a variable number of EditBoxes.

PNode=^TNode;
TNode=Record
  Edit:TEditBox;
  Next:PNode;
End;

(I used a Record, you can also use an Object or a Class)
0
DrDelphiCommented:
There's no need to use a link list... just make the arrays openended..


Var EditArray :array of Tedit;

begin
  SetLength(EditArray,Length(EditArray)+1);
  EditArray[length(editArray)]:=Tedit.create(self);
  yada,
  yada,
  yada,
 (You get the idea....)


0
kambizCommented:
Place all created TEdit controls on a Panel or a GroupBox. Then you can loop throw Controls property of container and save TEdit values into your array or list.
By this method you have the number of created EditBoxes on ControlCount property and EditBoxes in Controls[0] to Controls[ControlCount-1].

I hope this helps
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.