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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Control

Status
Not open for further replies.

erics55

Programmer
Nov 20, 2006
30
SE
Hi
I want to change the text property of a control. I need to do this in VB code and i do not know the name of the control until runtime. I am trying to use the find control function but I am not having any luck.

Can anyone help?
 
Make sure you are using the correct parent element when using the FindControl method. Then, step your your code and you should see if you are doing this correctly.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
ctrl = CType(Page.FindControl("lblWK1Mon"), Label)

this is the code I am using

I know for certain that there is a control called lblWK1Mon but this does not pick it up. Is the Page part not correct?

Thanks
 
As I said above, that may not be the control's correct parent. You'll have to step through your code to confirm if this is the case or not.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Hi Sorry to be a pain but I wouldnt know how to go about finding what the corrct parent would be. I have stepped through the code and it just sayd ctrl = nothing so it looks like Page isnt the correct parent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top