<b>procedure </b>TForm1.Button1Click(Sender: TObject);
<b>var</b>
j,i,min,max:integer;
<b>begin</b>
min:=StrToInt(StringGrid1.Cells[j,i]);
min:=max;
<b>For </b>i:=1 <b>to </b>StringGrid1.RowCount-1 <b>do</b>
<b>For </b>j:=1 <b>to </b>StringGrid1.ColCount-1 <b>do begin</b>
<b>if </b>StrToInt(StringGrid1.Cells[j,i])<min <b>then
</b>min:=StrToInt(StringGrid1.Cells[j,i]);
<b>if</b> StrToInt(StringGrid1.Cells[j,i])>max <b>then
</b>max:=StrToInt(StringGrid1.Cells[j,i]);
<b> end;</b>
Label4.Caption:=IntToStr(min);
Label3.Caption:=IntToStr(max);
<b>end;</b>