Convert text box to label with code

Murray Brown
Murray Brown used Ask the Experts™
In is it possible to convert a text box to a label using code
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
In is it possible to convert a text box to a label using code
not can't do that.

what is your intention here?
if you mean to initially to have a Text Box for data entry, and then once it's posted back, show what was entered as Label with static value, then you can have a TextBox (with Visible = True) for data entry (while a Label with Visible = False initially), once it's posted, make the TextBox's visible to False, and pass the value of TextBox to Label, and finally set the Label's Visible to True.
Shaun VermaakTechnical Specialist
Awarded 2017
Distinguished Expert 2018
TextBox t = new TextBox();
Label l = new Label();
Control c = (Control) t;
c = (Control) l;

Open in new window
Murray Developer


Thank you both

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial