BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help with variant type - null/unknown type?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal
View previous topic :: View next topic  
Author Message
BBaley
Guest





PostPosted: Tue Mar 28, 2006 5:04 pm    Post subject: help with variant type - null/unknown type? Reply with quote



Hi,
I am having difficulty with determining the variant type passed (from a
program / procedure I did not code - I am working on a DLL that is
called from this app)

I have tried to go through the known vartypes but the variant seems to
match none of them??

Normally I am trying to determine the cause of an EConverError: not a
valid floating point value (during debugging - the try-except handles
during execution normally)

Am I missing something (below) or is there a better way to do this? I
always come up with NO resulting vartype?

----------------------------------------------------------------
function VarToInt(V: Variant) : integer;
var
es : string;
begin
try
if not(VarIsNull(V) or VarIsEmpty(v)) then
begin
If ( VarType(v) IN[varByte, varSmallInt, varShortInt,
varInteger, varWord, varLongWord, varInt64]) then
begin
result := Integer(V);
end;
end
else
begin
If ( VarType(v) IN[varSingle, varDouble, varCurrency]) then
begin
result := Round(v)
end
else
begin

{$IFDEF Include_DBG_Display}
ShowMessage('wrong type: expected integer');

case VarType(v) of
varEmpty : es := 'Empty';
varVariant : es := 'Variant';
varUnknown : es := 'Unknown';
varAny : es := 'varAny';

varString : es := 'String';
varOLEStr : es := 'OLEStr';
varStrArg : es := 'StrArg';

varDate : es := 'Date';

varBoolean : es := 'Boolean';

varError : es := 'varError';
varDispatch : es := 'Dispatch';
end;

Showmessage('var = ' + es);
{$ENDIF}

result := 0;
end;
end;
except
on Exception do
result := 0;
end; {- try/except -}
Back to top
Riki Wiki
Guest





PostPosted: Sun Apr 02, 2006 3:03 pm    Post subject: Re: help with variant type - null/unknown type? Reply with quote



On 28 Mar 2006 05:00:59 -0800, BBaley wrote:

Quote:
Am I missing something (below) or is there a better way to do this? I
always come up with NO resulting vartype?

Hoi

You need to repost your question on the Borland news server to make
everybody see it and possibly answer your question. Further, this news
group do not officially exist, the group to use is
b.p.d.language.delphi.general.

Take a look here:
<http://tinyurl.com/8m5nw>
which links to
<http://delphi.wikicities.com/wiki/Delphi_Newsgroups>
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language ObjectPascal All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.