 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
BBaley Guest
|
Posted: Tue Mar 28, 2006 5:04 pm Post subject: help with variant type - null/unknown type? |
|
|
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
|
Posted: Sun Apr 02, 2006 3:03 pm Post subject: Re: help with variant type - null/unknown type? |
|
|
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 |
|
 |
|
|
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
|
|