Thread View: borland.public.delphi.language.objectpascal
2 messages
2 total messages
Started by BBaley
Tue, 28 Mar 2006 13:00
help with variant type - null/unknown type?
Author: BBaley
Date: Tue, 28 Mar 2006 13:00
Date: Tue, 28 Mar 2006 13:00
69 lines
3161 bytes
3161 bytes
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 -}
Re: help with variant type - null/unknown type?
Author: Riki Wiki
Date: Sun, 02 Apr 2006 14:52
Date: Sun, 02 Apr 2006 14:52
16 lines
1342 bytes
1342 bytes
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>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads