473,797 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1951
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 += numCharsToFitAL ine;

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****@NOSPAMr atethebuilder.c o.ukwrote in message
news:e7******** *****@TK2MSFTNG P02.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.CreateGrap hics().MeasureS tring(string text, Font font, int width);
or TextRenderer.Me asureText (.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
12221
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 all images and text have been displayed. This is the area that the visitor can 'scroll' up and down in. I have already calculated the height of the useable part of the browser using: document.body.clientHeight
1
4070
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 grows downwards. I have to change the recalculate and change location to make it appear growing up. Is there an easy way to change this or work around this? Alwin S.
0
1242
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 pictures in the PictureBox objects, I would also like to increase the window, so that the scroll bars appear. For some reason none of the following methods force the scroll bars to appear: this.ClientSize = new Size(layout_w, layout_h);...
6
1792
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 version of my page that shows the problem: *********************************************************************************** <html> <head></head>
1
6490
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 height to about 150%. I tried using CSS, now I am trying tables. Can someone show me where I am mixing things up? Thanks. --Master Sheet <%@ Master Language="C#" AutoEventWireup="true" CodeFile="master.master.cs" Inherits="pts" %>
4
8268
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 default value of 100. I wanted to know what other effects it will have on the database? Like, will the performance reduce, if the locklist size is 200 and 120 locks are on it as compared to when the locklist size is 130 and 120
1
1621
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 enter your e-mail address and password(Password must be of at least 6 characters).If you would like to use your access code (located on the front of your product), enter it in the box titled “I Want to Use My Access Code."></td> i want to increase...
0
1391
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.... now when i m increasing the size of component only button and label size get increase.But Jcombobox,JTextfield and table size unchanged.Plz any one help me,here is my code for increasing the size........ public void incPanel(int size) { ...
4
6355
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 inherited some code that at the view (User Interface) layer kicks off a background worker thread. At the service layer (think CAB service layer), there’s quite a lot of the following:
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9063
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.