Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Creating a array of const

Posted on 1997-10-12
Last Modified: 2010-04-04
How do you create a array that can be passed to Format.  I do not know what the number and type of arguments that need to be passed until run time.
The format string is not an issue, but the argument list is.
Question by:charry
  • 2

Author Comment

ID: 1347370
Edited text of question

Accepted Solution

JimBob091197 earned 50 total points
ID: 1347371

Try the following:
procedure TForm1.Button1Click(Sender: TObject);
      Args: array[1..10] of TVarRec;
      FillChar(Args, SizeOf(Args), 0);
      Args[1].VType := vtPChar;
      Args[1].VPChar := PChar('Bob');
      Args[2].VType := vtInteger;
      Args[2].VInteger := 5;
      Caption := Format('%s %d', Args);

Declare the Args array big enough for the maximum number of arguments.  Look up help on TVarRec for the different types.

Hope this helps.

Author Comment

ID: 1347372
Thanks JimBob thats what I needed!!!!!!!!

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Newbie Thread Programming 1 161
Delphi : could not find program, '...exe' 2 192
Convert a string into a TDateTime 5 64
Tvertscrollbox like a whatsapp layout 5 35
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question