By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

Dynamically setting textbox width

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.