Wine Too
Wine Too

Reputation: 4655

Accessing to control inside of usercontrol

I am making an usercontrol with only one textbox so basically I expect that properties of textbox have to be applied to whole usercontrol.
That means (for example) that I would like from outside of usercontrol (in main program which contain those usercontrol) to get value of those (intern) textbox's selectionstart property.

But I can't find a way to do this except in creating a new public property of my UC.
I suppose that here should be some better way because textbox have many properties which may be needed to read (or maybe write) from main program and making another public property in UC for every internal property of textbox don't seems like "way to go" for me.

Any advice on how to get properties of internal control in UC from main program?

Upvotes: 0

Views: 1035

Answers (2)

Sanfoor
Sanfoor

Reputation: 323

you may inherit your usercontrol from textbox control,liKe:

Class MyTextbox
      inherits TextBox
End class

and then try to override, overload and access the events and properties you want.


you can check the following links,
1- For textbox inheritance example
2- Answered Question in Satckoverflow

Upvotes: 1

Mad Dog Tannen
Mad Dog Tannen

Reputation: 7242

Will not a regular FindControl check solve this?

Upvotes: 1

Related Questions