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