Different ways of declaring listview or treeview control

K

Ken Warthen

What is the difference between the following two declarations? Is there an
advantage of one over the other?

Private lvxObj as MsComctlLib.ListView

Private lvxObj as ListView

Ken
 
M

Michel Walsh

In the first one, you specify the library you want to reach, in the second
case, you get the ListView from the first library which exposes such an
entity, and by 'first', that means an order, and the order is the one you
get by opening: Tools | References... (in VBE)

So, if you are lucky, of if only one library exposes a ListView entity, both
are equivalent.



The problem can be seen as in the case of Recordset:


Dim rst AS DAO.Recordset
and
Dim uvw AS ADODB.Recordset
and
Dim xzy AS Recordset


Is xyz be a DAO recordset, or an ADO recordset is anyone guess, and may even
change if ever your reference order changes!

So, unless you are pretty sure you won't have name collision from different
libraries, prefix with the library name.


Vanderghast, Access MVP
 
K

Ken Warthen

Michael,

Thanks for clearing up the issue.

Ken

Michel Walsh said:
In the first one, you specify the library you want to reach, in the second
case, you get the ListView from the first library which exposes such an
entity, and by 'first', that means an order, and the order is the one you
get by opening: Tools | References... (in VBE)

So, if you are lucky, of if only one library exposes a ListView entity, both
are equivalent.



The problem can be seen as in the case of Recordset:


Dim rst AS DAO.Recordset
and
Dim uvw AS ADODB.Recordset
and
Dim xzy AS Recordset


Is xyz be a DAO recordset, or an ADO recordset is anyone guess, and may even
change if ever your reference order changes!

So, unless you are pretty sure you won't have name collision from different
libraries, prefix with the library name.


Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top