Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Usercontrols

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
US
Hi,

I have a usercontrol with a number of textboxes on it.

Does anyone have any code that will loop through all the controls find a textbox and then set the readonly property to true.

I have tried this :

If TypeOf ctlForm Is HtmlForm Then
For Each ctlContent As Control In ctlForm.Controls
If TypeOf ctlContent Is ContentPlaceHolder Then
For Each ctlChild As Control In ctlContent.Controls
'Hide All textbox
If TypeOf ctlChild Is textbox Then
CType(ctlChild, textbox).readonly = true
End If
Next
End If
Next
End If

But obviously this doesnot work.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top