Getting properties of container into contained controls.

  • Thread starter Ray Cassick \(Home\)
  • Start date
R

Ray Cassick \(Home\)

Ok, here is apparently another odd one...

I am (as I said in a previous posting here) building a user control that
inherits from System.Windows.Forms.UserControl. This base class contains a
ForeColor property that I leave exposed in my inherited class. My intent
here is to allow users to set this property and then use it as the color for
several controls that I dynamically place onto the base Usercontrol as
needed.

I am placing controls onto my base Usercontrol as such:

Dim DVNLabel = New System.Windows.Forms.Label
DVNLabel.Location = New System.Drawing.Point(8, row)
DVNLabel.Name = ("DVNLabel" & controlCnt.ToString)
DVNLabel.Size = New System.Drawing.Size(labelColWidth, 16)
DVNLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
DVNLabel.Text = "Value Name"
.. . .
Me.Controls.Add(DVNLabel)

....now, you would think that I should be able to simply add a line as such:

DVNLabel.ForeColor = Me.ForeColor

....and propagate the ForeColor property of the base Usercontrol onto the
label that I just added.

But this does not work...

Anyone here have any ides? I expect to face the same problem with other
properties I may want to use the same feature of.



--
Raymond R Cassick
CEO / CSA
Enterprocity Inc.
www.enterprocity.com
3380 Sheridan Drive, #143
Amherst, NY 14227
V: 716-316-7537
Blog: http://spaces.msn.com/members/rcassick/
 
R

Ray Cassick \(Home\)

Ok, never mind this rant from me.. I must be getting tired...

I figured out my own stupid problem...
 

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