Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.delphi.misc > #623

Re: display array values in a label

Newsgroups comp.lang.pascal.delphi.misc
Date 2014-09-11 23:24 -0700
References <917dbf9e-f5aa-4a84-ba56-b1c1ff3e354e@googlegroups.com> <c7dncrFmuvU1@mid.individual.net>
Message-ID <adf4df8d-e0b5-4e07-ac77-01d76a5a83ad@googlegroups.com> (permalink)
Subject Re: display array values in a label
From Sandeepan Kashyap <sandeepan1982@gmail.com>

Show all headers | View raw


Thanks DoDi,

I am actually an experienced Mumps/Cache developer and have to learn Delphi for a new project. I am actually trying to print a series of number in ascending order, e.g. 1,2,3,4,5,6,7,8,9 but in every number should print in new followed line. like
1
2
3
.

I tried the below code. But the below code printing '0' always inside Label3, don't know why? what's is wrong with the code. Please enlighten me.

type
  TIntegerArray = Array[1..9] of Integer;
var
   x,y : integer;
  txt: string;
  i: integer;
  arrayOfIntegers : TIntegerArray;
begin
    Form1.Color := clGreen;
    x := StrToInt(Edit1.Text);
    y := StrToInt(Edit2.Text);

    i := 1 ;
    begin
      while (i = 9) do
      arrayOfIntegers[i] :=  i;
      Inc(i);
    end;
      Label3.Caption :=      IntToStr(arrayOfIntegers[i]);

I appreciate your reply.

Sandeepan.
On Thursday, September 11, 2014 7:16:05 PM UTC+5:30, Hans-Peter Diettrich wrote:
> Sandeepan Kashyap schrieb:
> 
> 
> 
> This code
> 
> 
> 
> >   Leng := Length(Edit1.Text);
> 
> >   SetLength(MyMatrix, leng);
> 
> >   for i := 1 to 3 do begin
> 
> >       begin
> 
> >         MyMatrix[i] := Edit1.text[i];
> 
> >       end;
> 
> >      end;
> 
> >   end;
> 
> >   for i:= 1 to leng do begin
> 
> >     txt := txt + MyMatrix[i];
> 
> >   end;
> 
> >   Label3.caption := txt;
> 
> 
> 
> is equivalent to
> 
> 
> 
>    Label3.Caption := Edit1.Text;
> 
> 
> 
> I don't understand what you want to do, please try to explain better.
> 
> 
> 
> DoDi

Back to comp.lang.pascal.delphi.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

display array values in a label Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-11 04:02 -0700
  Re: display array values in a label Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-09-11 15:44 +0200
    Re: display array values in a label Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-11 23:24 -0700
      Re: display array values in a label Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-09-12 18:01 +0200
        Re: display array values in a label Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-15 02:34 -0700
          Re: display array values in a label Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-15 02:36 -0700
          Re: display array values in a label Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2014-09-15 14:14 +0200
  Re: display array values in a label "Alan Lloyd" <alanglloyd@NotThisBitbtinternet.com> - 2014-09-25 11:51 +0100
    Re: display array values in a label Sandeepan Kashyap <sandeepan1982@gmail.com> - 2014-09-26 05:58 -0700
      Re: display array values in a label "Alan Lloyd" <alanglloyd@NotThisBitbtinternet.com> - 2014-09-26 19:53 +0100

csiph-web