Re: StringGrid to Edit.Text

Posted by Milsdam p12592 on October 11, 2007

In Reply to Re: StringGrid to Edit.Text posted by webmaster Guido on October 10, 2007

: ...and in fact, we even don't need the variable R ;)
: Let's rewrite everything in the most readable way:

: procedure TForm1.DownClick(Sender: TObject);
: begin
: if StringGrid1.Row < StringGrid1.RowCount - 1 then begin
: StringGrid1.Row := StringGrid1.Row + 1;
: Edit1.Text := StringGrid1.Cells[0, StringGrid1.Row];
: Edit2.Text := StringGrid1.Cells[1, StringGrid1.Row];
: Edit3.Text := StringGrid1.Cells[2, StringGrid1.Row];
: Edit4.Text := StringGrid1.Cells[3, StringGrid1.Row];
: end
: else
: Beep;
:
: Good luck!

Guido,
Thanks for your comment, I've learned a great deal from it. Your final piece of code is a real eye-opener!