Solved

Creating a array of const

Posted on 1997-10-12
3
157 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now