RPC Broker TMult Example

From VistApedia
Jump to: navigation, search

RPC Broker Help Home

TMult Example

The following program code demonstrates how to store and retrieve elements from a TMult variable:


   procedure TForm1.Button1Click(Sender: TObject);
   var
     Mult: TMult;
     Subscript: string;
   begin
     {Create Mult. Make Form1 its owner}
     Mult := TMult.Create(Form1);
     {Store element pairs one by one}
     Mult['First'] := 'One';
     Mult['Second'] := 'Two';
     {Use double quotes for M strings}
     Mult['"First"'] := '"One"';
     {Label1.Caption will get "One"}
     Label1.Caption := Mult['"First"'];
     {Error! 'Third' subscripted element was never stored}
     Label1.Caption := Mult['Third'];
   end;