Making a Textbox grow vertically , automatically

daleman
04-03-2003, 08:47 AM
Hi

I am trying to get a multiline textbox to automatically expand vertically when it can no longer contain any more text (a la th 'To' line in Outlook)

Whilst this can be easily accomplished with a fixed widt font, anyone have any ideas using regular fonts? No events triggered when the first line "overflows" or whatever -

Any ideas gratefully appreciated...

Machaira
04-03-2003, 10:54 AM
This may be silly but isn't that what scrollbars are for? Give the user a couple of lines by default and set the Scrollbars property to show a vertical scrollbar if necessary. I consider Outlook's To textbox to be a bad example of interface design. It would only be worse if the textbox is at the top of a form and you have to push every other control down to make room as it expands. That's just silly.

daleman
04-03-2003, 11:42 PM
Hi, and thanks for your thoughts. Unfortunately, apparently not everyone shares your ideas on interface design... The "self-adjusting" textbox is a specific request from a group of my users.

To be fair, I do see their point in that it makes more information visible, and as the particular screen in question is relatively uncluttered, there will be no problem (within reason) with moving other components downward.

On that basis, do you have any ideas on how to implement the beastie, or should I give up, concede to a superior solution , and get on with my life...

Flyguy
04-04-2003, 12:10 AM
Something like autowrap and add some extra space?
I can only think of a ugly work around at the moment.
In the Change event of the textbox put all data of the Textbox in a Label control. Which is set to autosize, has autowrap and force it to have the same width as the textbox. This will force the Label control to adjust it's height.
Give the Textbox control the same height as the label control.

daleman
04-04-2003, 01:21 AM
well if nothing else that is a clever solution, flydood - it will do the job and keep a few dribblers (ie irritating users ) happy


thanks again!

MasterTom
07-15-2003, 07:40 AM
Something like autowrap and add some extra space?
I can only think of a ugly work around at the moment.
In the Change event of the textbox put all data of the Textbox in a Label control. Which is set to autosize, has autowrap and force it to have the same width as the textbox. This will force the Label control to adjust it's height.
Give the Textbox control the same height as the label control.
So tell me what am i doing wrong???

Got a label (lblDescription(0)) with "autosize" and "wordwrap" set to "true".... and a label with the intended WIDTH...
and the following code:
Private Sub lblDescription_Change(Index As Integer)
lblDescription(Index).Width = label1.Width
End Sub

Why doesnt this work??

Edit:

Nevermind... it DOES work... I tested it WITHOUT spaces....so wordwrap doesnt work.... (foolish... i know ;)).,...

CYA in heaven....

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum