Multiline TextBox expand as characters exceed space

I want to put a 2 line multiline textbox on the page.

As the user fills up the two lines, I want it to grow another line, etc.; so they still see the entire box as they're typing.
Maybe also have the ability for a maxrows of so much.

Is there anyway to do this?

Using VB and 3.5 sp1.

Starr DuskkASP.NET VB.NET DeveloperAsked:
Who is Participating?
NicksonKohConnect With a Mentor Commented:
You should do this in javascript.

This code might come in handy for me too :)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <script type="text/javascript" language="javascript">
function Resize(obj) {
  var txt = obj.value;
  var maxRows = 10;
  var maxChar = 100;
  var arrTxt = txt.split(/[\n\f\r]/);
  var cntLines = arrTxt.length;
  for (var i = 0; i < arrTxt.length ; i ++ )
    if (Math.ceil(arrTxt[i].length / 20) > 1) {
      cntLines += Math.ceil(arrTxt[i].length / 20) - 1;
  document.getElementById("Text1").value = arrTxt.length + " breaks ; " + cntLines + " lines";
  if (obj.rows > maxRows) {
    alert('Max Rows Reached!');
    return false;
  if (txt.length > maxChar) {
    alert('Max Characters Reached!');
    obj.value = obj.value.substr(0, maxChar)
    return false;
  if (obj.rows == maxRows) return true;
  obj.rows = cntLines + 1;
  return true;
    <textarea id="TextArea1" cols="20" rows="2" onkeyup="return Resize(this)"></textarea>
    <input id="Text1" type="text" />

Open in new window

Starr DuskkASP.NET VB.NET DeveloperAuthor Commented:
excellent! Thanks!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.