Click here to Skip to main content
15,891,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a textbox and i want his width to be increased as user goes on entering data into textbox.....
Posted

C#
int size = 5;

int finalWidth = size* txtBox.Text.Length;

txtBox.Width = new Unit(finalWidth);

 You'll need to change size to be how big you want to allow per letter.
 
Share this answer
 
Comments
Sorry I added one comment by mistake. I have deleted that. Please ignore that.

Thanks,
Tadit
Google [^]is your friend. This has been done so many times that internet is full of examples.

If you want to use jQuery, this [^]one is a good example.
 
Share this answer
 
@Manas
in this they are increasing height i want to increase width of the textbox and i searched of google thats first thing everyone will do but i didnt got any solution working for me thats i asked in this site.
 
Share this answer
 
Comments
This is not an answer. Please delete this and if you want to reply to any answer, then click on "Have a Question or Comment" in that Answer Box itself.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900