[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 122
  • Last Modified:

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!
0
TPAKTOP
Asked:
TPAKTOP
1 Solution
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now