471,059 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,059 software developers and data experts.

Dynamically setting textbox width

What's the trick to dynamically setting the width of a textbox?

In the code behind page Page_Load function I'm trying to dynamically set the
width of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.

I tried doing a CType to cast the value as a WebControl Unit and also tried
using "75" and 75. Neither worked.

What am I missing?
Nov 20 '05 #1
2 9965
TextBox1.Width = New WebControls.Unit(75)

"Jacques Leclerc" <ja*************@hotmail.com> wrote in message
news:OI**************@TK2MSFTNGP09.phx.gbl...
What's the trick to dynamically setting the width of a textbox?

In the code behind page Page_Load function I'm trying to dynamically set the width of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.

I tried doing a CType to cast the value as a WebControl Unit and also tried using "75" and 75. Neither worked.

What am I missing?

Nov 20 '05 #2
Hello

I tried textbox1.width = 75 and it worked fine..

How about : Me.TextBox1.Size = New System.Drawing.Size
(80, 20)

Kind Regards
Jorge
-----Original Message-----
What's the trick to dynamically setting the width of a textbox?
In the code behind page Page_Load function I'm trying to dynamically set thewidth of a textbox.

TextBox1.Width = "75px"

I keep getting an error that the size has to be in WebControls.Units.
I tried doing a CType to cast the value as a WebControl Unit and also triedusing "75" and 75. Neither worked.

What am I missing?
.

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Laura | last post: by
8 posts views Thread by Donald Xie | last post: by
reply views Thread by Mike Collins | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.