Difference between revisions of "RPC HELP TMult L Example"

From VistApedia
Jump to: navigation, search
 
Line 1: Line 1:
 
<H2>Last Example</H2>
 
<H2>Last Example</H2>
[[RPC_HELP_Mult_Sorted|Back]]
+
[[RPC_HELP_Mult_Last|Back]]
  
 
The following program code displays the subscript and value of the last item in a Mult variable in the caption of a label when the user clicks the GetLast button:
 
The following program code displays the subscript and value of the last item in a Mult variable in the caption of a label when the user clicks the GetLast button:

Latest revision as of 22:38, 3 July 2015

Last Example

Back

The following program code displays the subscript and value of the last item in a Mult variable in the caption of a label when the user clicks the GetLast button:

   procedure TForm1.GetLastClick(Sender: TObject);
   var
     Mult: TMult;
     Subscript: string;
   begin
     {Create Mult. Make Form1 its owner}
     Mult := TMult.Create(Form1);
     Mult['Fruit'] := 'Apple';
     {Store element pairs one by one}
     Mult['Vegetable'] := 'Potato';
     Label1.Caption := 'The subscript of the last element: ' + Mult.Last +
     ', and its value: ' + Mult[Mult.Last];
   end;