Working with Tags

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone please tell me what I'm doing wrong in my code? I'm trying to
change the ENABLED property of a User Control Button using the tag property
when another User Control Button is clicked.

Dim sControls As ControlCollection = Me.Parent.Controls
Dim y As Control

For Each y In sControls
If y.Tag = "select" Then
y.Text = "test"
End If
Next
I can run the same code on other controls in the form and it runs fine; but
when I try to change this User Control Button Property it doesn't do
anything. What am I doing wrong?
 
I figured out what I did wrong. For anyone interested; I had to enter the tag
in the User Control Property and then I had to Rebuild the Control.
 
Terrance,

It can be a lot and important is what you mean with you mean what is going
wrong.

(Getting an error, it does not change, etc. )
Dim sControls As ControlCollection = Me.Parent.Controls
Dim y As Control

\the above is from version 2003 not needed

Probably can you better give the name of the control instead of Parent it
seems for me a little bit weird now because this can be everything.

\\\\
For Each ctr as Control In xx.Controls
If y.Tag.ToString = "select" Then
'are you sure that the case is right by the wa
y.Text = "test"
End If
Next
///

Maybe this helps,

Cor
 
Back
Top