Re: Simulating VB Nothing variant in Delphi
- From: "Viatcheslav V. Vassiliev" <support@xxxxxxxxxxxxxxx>
- Date: Sat, 24 Jun 2006 11:34:02 +0400
In most cases Unassigned (or Null) will work, however in few special cases
IDispatch(nil) should be used instead of Unassigned (some ActiveX components
may have different actions for these two).
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Steve Zimmelman" <skz@xxxxxxxxxxxxxxxxxx> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:449bd5c9$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Mike is correct. Use UnAssigned when using COM and OleVariants.
********************
From Delphi Help:
********************
In the code fragment shown below, the statement that assigns Unassigned to
the MSWord variable causes the OLE Automation Object that was created to
interface with Word to be released.
var
MSWord: Variant;
begin
...
MSWord := CreateOleObject('Word.Basic');
...
MSWord := Unassigned;
...
end;
********************
In VB it would be [Set MSWord = Nothing].
-Steve-
"Ian Hinson" <pparagon@xxxxxxxxxxxxxx> wrote in message
news:4499d7fb@xxxxxxxxxxxxxxxxxxxxxxxxx
"Mike Shkolnik" <mshkolnik2002@xxxxxxx> wrote in message
news:4499a17d@xxxxxxxxxxxxxxxxxxxxxxxxx
UnAssigned in Delphi is the same as Nothing in VB
cat.ActiveConnection := UnAssigned;
Have to disagree on that, sorry.
The Unassigned function returns a variant with VType varEmpty,
whereas the Nothing variant in VBA is a variant with VType varDispatch.
.
- References:
- Simulating VB Nothing variant in Delphi
- From: Ian Hinson
- Re: Simulating VB Nothing variant in Delphi
- From: Mike Shkolnik
- Re: Simulating VB Nothing variant in Delphi
- From: Ian Hinson
- Re: Simulating VB Nothing variant in Delphi
- From: Steve Zimmelman
- Simulating VB Nothing variant in Delphi
- Prev by Date: Re: ProgressBar and ADO Dataset
- Next by Date: Re: ProgressBar and ADO Dataset
- Previous by thread: Re: Simulating VB Nothing variant in Delphi
- Next by thread: CDS, Query and Access
- Index(es):
Relevant Pages
|