Link to home
Start Free TrialLog in
Avatar of PeterdeB
PeterdeBFlag for Netherlands

asked on

How to fill all edits with random characters ranging from A to Z all with a space in front of the character?

Hi Folks!

Is it possible to fill each and every edit with  a space + a randomly chozen character ranging from > A to Z ?


Regards Peter

Provide a working sample > this will grant you the points ofcourse :)
Avatar of shaneholmes
shaneholmes

procedure TForm1.Button1Click(Sender: TObject);
var
 I, C: Integer;
begin
 randomize;
 for I:= 0 to ComponentCount -1 do
  if Components[I] is TEdit then
  begin
   repeat
    C:= Random(90) + 1;
   until (C > 65) AND (C <= 90);
   TEdit(Components[I]).Text:= Char(C);
  end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
 I, C: Integer;
begin
 randomize;
 for I:= 0 to ComponentCount -1 do
  if Components[I] is TEdit then
  begin
    C:= Random(26)+65;
   TEdit(Components[I]).Text:= ' '+Char(C);
  end;
end;

=o)
ASKER CERTIFIED SOLUTION
Avatar of shaneholmes
shaneholmes

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
lol, it happened to me just now in another question...

give the points to shaneholmes, I just polished the code
Avatar of PeterdeB

ASKER

Ok guys tnx for the responses. I will follow up to your advice BlackTigerX!

Perfect code!

Regards and respect,

Peter
Thankx BlackTigerX!

Shane