Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

help with variant type - null/unknown type?

80 views
Skip to first unread message

BBaley

unread,
Mar 28, 2006, 8:00:59 AM3/28/06
to
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 -}

Riki Wiki

unread,
Apr 2, 2006, 10:52:08 AM4/2/06
to
On 28 Mar 2006 05:00:59 -0800, BBaley wrote:

> 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>

0 new messages