469,578 Members | 1,700 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

referencing properties of objects wthin object Collections

What is the syntax for referencing the properties of
objects within Collections of objects?

EXAMPLE:

Dim MCoil As New Coil
MCoil = CoilCollection("3456")
TextBox1.Text() = MCoil.CoilDesc

WANT TO BE ABLE TO AVOID INTERMEDIARY COPY (SOEMTHING
LIKE):

TextBox1.Text() = CoilCollection("3456").CoilDesc

Thanks,
Terry
Nov 20 '05 #1
2 1021
Hi,

TextBox1.Text() = DirectCast(CoilCollection("3456"),Coil).CoilDesc

Ken
------------
"Terry" <no*****@mail.com> wrote in message
news:24*****************************@phx.gbl:
What is the syntax for referencing the properties of
objects within Collections of objects?

EXAMPLE:

Dim MCoil As New Coil
MCoil = CoilCollection("3456")
TextBox1.Text() = MCoil.CoilDesc

WANT TO BE ABLE TO AVOID INTERMEDIARY COPY (SOEMTHING
LIKE):

TextBox1.Text() = CoilCollection("3456").CoilDesc

Thanks,
Terry


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #2
Since you mention Collections of Objects, so I am assuming you are not using a
strongly typed collection.
I am also assuming that your problem is that the Object returned, does not know
about the CoilDesc property.
In this case, you seem fairly certain that the returned Object will be of type
Coil, so I would recommend a DirectCast.
TextBox1.Text = DirectCast(CoilCollection("3456"), Coil).CoilDesc

In a nutshell, it is doing the same thing you were doing before, but just in 1
line and a little quicker.
(note, I didn't test the above, so please forgive any typo's)

Gerald

"Terry" <no*****@mail.com> wrote in message
news:24*****************************@phx.gbl...
What is the syntax for referencing the properties of
objects within Collections of objects?

EXAMPLE:

Dim MCoil As New Coil
MCoil = CoilCollection("3456")
TextBox1.Text() = MCoil.CoilDesc

WANT TO BE ABLE TO AVOID INTERMEDIARY COPY (SOEMTHING
LIKE):

TextBox1.Text() = CoilCollection("3456").CoilDesc

Thanks,
Terry

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by thechaosengine | last post: by
5 posts views Thread by Jason Butera | last post: by
1 post views Thread by Manny Silva | last post: by
2 posts views Thread by Miky | last post: by
5 posts views Thread by Simon | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.