Re:Typecast SET to INTEGER ?
In article <31DBFE83.7...@atcon.com>, fe...@atcon.com says...
Quote
>I realize that this is not a true database question, but most of my work
>is in database and I tend not to follow the other Delphi Groups.
>Altho there must be a simple way to typecast an integer to a set and
>visa versa, I can't seem to get it. Read the docs, etc. Have not had
>this prob with other languages. I can think of inelegant ways to do it,
>but I much prefer simple elegance.
>Any suggestions?
>Thx,
>Joe
Hi Joe,
I have tried it and it should work:
procedure TForm2.HCButton1Click(Sender: TObject);
TYPE TXX = (A, B, C, D, E, F, G, H, I, J, K);
TSetOfXX = Set Of TXX;
VAR
AnySet : TSetOfXX;
wSet : Word;
begin
AnySet := [A, B, C, D, E, F, G, H, I];
wSet := Word (AnySet);
end;
Hope it helps
Bye
Andreas
=============================================
helicon software development - Andreas Prucha
Baden/Vienna, Austria - heli...@helicon.co.at
=============================================