1. Computing

Delphi Enum to String


Here's how to display the string represention of a Delphi enum type at runtime.

Suppose enum:

TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;

uses TypInfo;
var s: string;
s := GetEnumName(TypeInfo(TProgrammerType),
                  integer(tpDelphi)) ;



Delphi tips navigator:
» How to install an INF file using Delphi
« Using an object with no reference variable

©2014 About.com. All rights reserved.