By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,280 Members | 2,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,280 IT Pros & Developers. It's quick & easy.

referencing properties of objects wthin object Collections

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.