Solved

Creating a array of const

Posted on 1997-10-12
3
161 Views
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.
0
Comment
Question by:charry
  • 2
3 Comments
 

Author Comment

by:charry
ID: 1347370
Edited text of question
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 50 total points
ID: 1347371
Hi

Try the following:
procedure TForm1.Button1Click(Sender: TObject);
var
      Args: array[1..10] of TVarRec;
begin
      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);
end;

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

Hope this helps.
JB
0
 

Author Comment

by:charry
ID: 1347372
Thanks JimBob thats what I needed!!!!!!!!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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