Solved

Creating a array of const

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

17 Experts available now in Live!

Get 1:1 Help Now