473,320 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Increasing height of text box

Hi

I have a multi-line text box displaying data inside a datagrid. I have the
height set to 50px and the width to 200px. If the data populating the text
box is larger than this, then naturally the scrollbars appear.

What I need is rather than the vertical scroll bar to appear, that the text
box increases in height to contain the text.

Any ideas or pointers to tutorials would be greatly appreciated.

Thanks in advance.

Brendan

______________________________________________
Rate your experiences with your UK and Ireland builders at
http://www.ratethebuilder.co.uk
=========================================
Oct 5 '06 #1
2 1931
Strange requirement? But hey ho.

I dont know if the textboxes have an event for when the scrollbars kick in,
if they do hook that event and on that event firing dont show scroll bars
but increase size.

Assuming that event does not exist you could work out roughly how many
characters it can contain in its initial state and on keyPress store the
length of data in the textbox and do:-

//pseudo code
If length maxChars
/ /increase size by x pixels
maxChars += numCharsToFitALine;

Something like that should work? Its not sexy code at all but off the top of
my head thats a quick fire solution
"RateTheBuilder" <fo****@NOSPAMratethebuilder.co.ukwrote in message
news:e7*************@TK2MSFTNGP02.phx.gbl...
Hi

I have a multi-line text box displaying data inside a datagrid. I have the
height set to 50px and the width to 200px. If the data populating the text
box is larger than this, then naturally the scrollbars appear.

What I need is rather than the vertical scroll bar to appear, that the
text box increases in height to contain the text.

Any ideas or pointers to tutorials would be greatly appreciated.

Thanks in advance.

Brendan

______________________________________________
Rate your experiences with your UK and Ireland builders at
http://www.ratethebuilder.co.uk
=========================================

Oct 5 '06 #2
Hello RateTheBuilder,

You can set the height of your textbox based on the calculation of your text
hight multiply by number of lines

To calc the text size use
this.CreateGraphics().MeasureString(string text, Font font, int width);
or TextRenderer.MeasureText (.net 2.)

but, take into account that the real size of you sign could be more then
calculated, because these methods don't calc glyph size.
RHi
R>
RI have a multi-line text box displaying data inside a datagrid. I
Rhave the height set to 50px and the width to 200px. If the data
Rpopulating the text box is larger than this, then naturally the
Rscrollbars appear.
R>
RWhat I need is rather than the vertical scroll bar to appear, that
Rthe text box increases in height to contain the text.
R>
RAny ideas or pointers to tutorials would be greatly appreciated.
R>
RThanks in advance.
R>
RBrendan
R>
R______________________________________________
RRate your experiences with your UK and Ireland builders at
Rhttp://www.ratethebuilder.co.uk
R=========================================
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Oct 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul | last post by:
Hi, I'm wondering if someone out there can help me overcome this quandary. I need to be able to calculate the height of the current page. I need to calculate the height of the page in pixels after...
1
by: Al Sav | last post by:
Hi, I am trying to mimic a graph and using labels to draw bars (I know there are plenty of chart-graph controls, but I have to do it this way). When increase the height dynamically, the label...
0
by: 6tc1 | last post by:
Hi all, I have a class (call it class A) that extends UserControl (there is no reason that this couldn't extend Panel). I have a few PictureBox objects in class A. When I increase the size of the...
6
by: tshad | last post by:
I have a cell with 2 items in it: a textbox and a link. The link is actually a button (image), but for the example I am using a link, which is doing the same thing. Here is the stripped down...
1
by: Mike Collins | last post by:
I am trying to create some pages and have them take 100% of the window, but I cannot get 100% to work. If I set the height of my div, the page displays a scroll bar and it looks like I set the...
4
by: Rahul B | last post by:
Hi, I was getting the error: sqlcode: -911 sqlstate: 40001 , which is "The maximum number of lock requests has been reached for the database." So i increased the locklist size to 200 from the...
1
by: jesmi | last post by:
my code is like this: <td width="11%" class="valError"><img src="<%=request.getContextPath()+"/"%>images/action/log-info.gif" title="If you are already a member of the Image Star Network, please...
0
by: wajedali | last post by:
hi......... i have problem in incresing and decreasing the component. I have a one main panel (i.e. i used as _basewindowPanel) in that again two panel in that two panel like wise.... ...
4
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
Visual Studio 2005, C# WinForms application: Here’s the question: How can I increase the standard 1 MB stack size of the UI thread in a C# WinForms application? Here’s why I ask: I’ve...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.