\n to get number of lines.then if the characters per
line is over 48 then another line added.at last textbox
Rows is set according to lines -
string Comment=obj.Text;//first gets the content from database
int y = 0; int lines; int temp; int lines2;
string[] linesarray = Regex.Split(Comment, "\n");
lines = Convert.ToInt32(linesarray.Length);
lines2 = lines;
for (int app = 0; app < lines2; app++)
{
temp = linesarray[app].Length / 48;
if (temp > 0) { lines = lines + temp; }
}
if (lines > 7)
{
if (lines > 21) { setrows.Rows = 21; } else { setrows.Rows = lines; }
}
else
{ setrows.Rows = 7; } y++;