MultiLine TextBox, how to set height?

Discussion in 'ASP .Net' started by Olav Tollefsen, Jan 30, 2005.

  1. I have a MultiLine TextBox to which I add text like this:

    TextBox1.Attributes.Add("style","overflow :hidden");
    TextBox1.Text = "Line 1\r\nLine 2\r\nLine 3";

    The number of lines added to the TextBox can be variable.

    Right now (without setting any width / height), I can only see two lines of
    text. If I click with the mouse in the TextBox, I can see the rest of the
    text by moving the the mouse inside the TextBox.

    How can I set the height / width of the TextBox to be exactly right to
    display all the content?

    Olav
    Olav Tollefsen, Jan 30, 2005
    #1
    1. Advertising

  2. I found that it was better to use a Label and this code instead:

    Label1.Text = "Line 1<br />Line 2<br />Line 3";

    Olav

    "Olav Tollefsen" <> wrote in message
    news:...
    >I have a MultiLine TextBox to which I add text like this:
    >
    > TextBox1.Attributes.Add("style","overflow :hidden");
    > TextBox1.Text = "Line 1\r\nLine 2\r\nLine 3";
    >
    > The number of lines added to the TextBox can be variable.
    >
    > Right now (without setting any width / height), I can only see two lines
    > of text. If I click with the mouse in the TextBox, I can see the rest of
    > the text by moving the the mouse inside the TextBox.
    >
    > How can I set the height / width of the TextBox to be exactly right to
    > display all the content?
    >
    > Olav
    >
    >
    Olav Tollefsen, Jan 30, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Middlemiss
    Replies:
    2
    Views:
    5,237
    Jacob Yang [MSFT]
    Nov 10, 2003
  2. tshad
    Replies:
    1
    Views:
    1,689
    bruce barker
    Mar 8, 2007
  3. JC

    textbox height = containing cell height - x

    JC, Jul 29, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    177
    DujHoD
    Aug 2, 2004
  4. dale zhang
    Replies:
    8
    Views:
    419
    Tintin
    Nov 30, 2004
  5. Don Vaillancourt

    How to tell height of div where height is not set?

    Don Vaillancourt, Jan 28, 2005, in forum: Javascript
    Replies:
    8
    Views:
    145
    Dietmar Meier
    Jan 31, 2005
Loading...

Share This Page