Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Richtextbox, How To Adjust Line Height?

Row!, Great interface!
The only thing bad is I have no time to investigate.
back to the pt
Is there a way to adjust line seperation of text in richtext box control ? if no method is suitable, can i use the /par and how?

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Richtextbox, How To Adjust Line Height?
Row!, Great interface!
The only thing bad is I have no time to investigate.
back to the pt
Is there a way to adjust line seperation of text in richtext box control ? if no method is suitable, can i use the /par and how?

Line Height In RichTextBox Control.. Anyone?

Any ideas on how can I determine the actual height (in pixel) of a Line in RichTextBox control?

Get Line Height Of RichTextBox Line - Api?
I need to get the line height from rich text box...

I know for a fact that the fon't size is the same in all the line...

need API for it?

If so.. how?

thanks in advanced

Excel Row Height Adjust
VB 6
Excel 9

If I write a too much large line of text into an Excel cell, y can go to 'cell format' menu and adjust the Horizontal and Vertical settings. Then I just double click on the bottom of the cell in its most left side and the cell height adjusts automatically so that I can see the complete text.

I am using the Excel object into my VB code but I do not know what property or method is which I need to invoke and the syntaxis.

Set Excel = New Excel.Application
Excel.Workbooks.Add App.Path & "xls emp-otpc.xls"

Automatically Adjust Height Of The Row
I wqrote this macro, whcih inserts pictures into the excel worksheet and then it adjusts the height of the first row to the height of the picture. But the problem is that this macro only adjust the height of all the rows according to the height of the first inserted picture. What I want is I want each row to automatically adjust to the height if the picture that's placed in this row. Please, let me know what's wrong with my macro and I would also apreciate any suggestions on how to solve this problem. I greately apreciate it. Thank you.
here is the macro:

Sub Macro1()
Dim i As Integer
Dim p As Integer
Dim iHeight As Double
Dim iDividor As Double
Dim Counter As Boolean
Dim sFilename As String
Dim SamePicture As String
Dim SamePicture2 As String
Dim sFilename2 As String
Dim bcontinue As Boolean
Dim spath As String
Dim iRest As Double
iDividor = 5.25
iRest = 3.75
i = 1
SamePicture = njd3
bcontinue = True
spath = "P:PicturesJPG"

Set oFSo = CreateObject("Scripting.FileSystemObject")

While bcontinue
sFilename = Worksheets(1).Cells(i, 3).Value
sFilename2 = Worksheets(1).Cells(i, 2).Value
iPos = InStr(1, sFilename, "-")
If iPos <> 0 Then
SamePicture2 = Mid(sFilename, 1, iPos)
End If
Counter = True
'worksheets is the number of the sheets, e.g. sheet1 = 1 sheet 2 = 2 etc.
'cells is the cell, the first parameter the row, the second the column
If sFilename <> "" And sFilename2 <> "" Then
Range(Cells(i, 1), Cells(i, 7)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
End If
If sFilename = "END" Then
bcontinue = False
Range(Cells(i, 1), Cells(i + 2, 1)).Select 'select the cell where it should be inserted
If sFilename <> "" And sFilename2 <> "" Then
End If
sFilename = spath + sFilename + ".jpg"
If oFSo.fileExists(sFilename) And (SamePicture <> SamePicture2) Then
'inserts picture and select it
iHeight = Worksheets(1).Shapes(1).Height
Cells(i, 1).RowHeight = iHeight
Counter = False
sFilename = Worksheets(1).Cells(i, 3).Value
iPos = InStr(1, sFilename, "-")
If iPos <> 0 Then
sFilename = Mid(sFilename, 1, iPos)
SamePicture = sFilename
End If
'Selection.ShapeRange.IncrementLeft 5
'Selection.ShapeRange.IncrementTop 12
End If
i = i + 1
End If
p = p + 1
End Sub
iHeight = Worksheets(1).Shapes(1).Height

Cann't Adjust Height And Width
On my form (under properties) i have width at 7050 and height at 1935
The width is fine but the height always adjusts itself to about 2500 when i run the exe file.

the following is from you form_load setting:

Me.Left = GetSetting(App.Title, "Settings", "MainLeft", 1000)
Me.Top = GetSetting(App.Title, "Settings", "MainTop", 1000)
Me.Width = GetSetting(App.Title, "Settings", "MainWidth", 7050)
Me.Height = GetSetting(App.Title, "Settings", "MainHeight", 1920)

any help would be appreciated.

DataGrid Auto Adjust Row Height

I am trying to display the contents of memo fields into a DataGrid so that each row height is adjusted to the size of the field.

Is this possible as I am having some difficulty finding an answer?

With DataGrid1
.Columns(0).Width = 1500
.Columns(1).Width = 9000
.Columns(1).WrapText = True
End With
This code wraps the text properly but only displays the top line (I know that the rows can be adjusted manually at runtime by the user but would rather adjust it as part of the code!

Thanks in advance

Auto Adjust Row Height Of MSFlexgrid
I have kept the Word wrap properties as “True” for MSFLEXGRID1. On run time it is wrapping the text but the row height is not adjusting automatically. Allow resizing is set to false. How the row height can be adjusted runtime so that the text will be displayed fully?

How To Adjust Carecter Width And Height

I need to adjust the charecter width or charecter height individually (increasing or decreasing char width or height) for the text enterd. Please help me how to do that. Thanks in advance.



Adjust Height Of Rich Text Box In Vb
Hii i have a problem in adjusting height of the richtext box according to the font size. i want the richtext box height that could show all the text that richtextbox contains so that there should not be virtical scrollbar could i find the linespacing, font height, emheight, and vertical resolutions of richtext box text, or any general text in vb
thanking u
rajesh kr. singh

[Not Resolved]how To Adjust Datagrid Height?
Need your help, I just want to adjust automatically the datagrid height everytime there is an added row in datagrid and i want the datagrid row to be aligned with the datagrid height. how to do that? kindly help.thanks.

Edited by - edd_hills on 12/23/2007 1:11:16 AM

How To Adjust Row Height For MSHFlexGrid During Run Time?
How to set row height for a row in MSHFlexGrid during run time? Thank you.

How Do You Adjust A Flex Grid Column Height?
I have a Flex Grid and in a column, accumulates several recordset, these recordsets are listed in the Grid's column separated by page breaks, i want to automatically expand the column Height to be able to see all listed stuff here. Can someone provide with a Sample code to do this. I cant find a column height property(only ColWidth).


How To: Adjust Height Of RptTextbox/rptLabel In DataReport
I have set the BorderStyle to rptBSSolid and extend upward to increase the height of the rptLabel at design time. The result during runtime only shows that the caption has moved upward instead of the rptLabel height to increase upward.

Is it possible to adjust the control's height? How?


How Can I Adjust Combobox Height Greater Than Default (315)?
I cannot make the height of a combobox on my form greater than 315, is there a special reason for this? The reason why is because I am using a combobox in a grid to enter data and I need to adjust the height of my combobox to the height of the cell in the grid where the combobox is needed...Any help in this regard will be appreciated...

"The answer is out there, Neo, it’s looking for you. And it will find you, if you want it to."--Trinity to Neo

How Can I Adjust Form Width && Height To A Contained Text Box
I’m attempting to create a message box that can utilize the font properties of size, bold and multiline. I use label inside a form and pass the string and properties by a user defined type.

The label works OK.

The problem:
I cannot seem to get the form width to adjust to the label length correctly. To work correctly, the form width should adjust to the length of the label regardless of the properties of the font.

I have tried the following:
frmNewBox.Width = frmNewBox.Width + iWidth * TextWidth("X") * 42
where iWidth = the number of characters in the longest line
frmNewBox.Width = frmNewBox.Width + lblMessage.Width

I have set the scalemode to both twips & characters.

The height of the form is adjusted with the following which was derived experimentally and seems to be acceptable. But I think there may be a better way...
frmNewBox.Height = frmNewBox.Height + TextHeight(NewBox.Message) * 200

Does anyone have a method to accomplish this?

Adjust Mshflexigrid Height When Adding And Removing Rows
I have been fighting adjusting the Mshflexigrid height for a long time. If i make the height too short the bottom rows bottom line does not show. If i make it to tall then the gray shows below the grid. This function i created kinda works, but is not perfect.
Function GridAdjustments() 'fine tune grid height
With LeftGrid
If .Rows < 15 Then
GridAdjustments = 246

ElseIf .Rows >= 15 And .Rows < 19 Then
GridAdjustments = 244

ElseIf .Rows >= 19 And .Rows < 29 Then
GridAdjustments = 243

ElseIf .Rows >= 29 And .Rows < 44 Then
GridAdjustments = 244

ElseIf .Rows >= 44 And .Rows < 60 Then
GridAdjustments = 241

GridAdjustments = 245
End If

End With
End Function
This grid has all the rows the same height
Does anyone know of a more precise method ?

Msflexgrid Auto Adjust Row And Column Height And Width
i am attaching a project where it strips a webpage takes it values and creates a text file out of it

im using a msflexgrid to display the values

i would like to add a feature where it will auto adjust the height and width of the row and columns on the run

pls help me

Msflexgrid Auto Adjust Row And Column Height And Width
i am attaching a project where it strips a webpage takes it values and creates a text file out of it

im using a msflexgrid to display the values

i would like to add a feature where it will auto adjust the height and width of the row and columns on the run

pls help me

Row Height In Excel Does Not Adjust When Text Is Longer And Wordwrap Is On
Can anyone help me here?

The cell in excel is "Wordwrap" activated and I can see the text which is longer than that shown on the screen when I get into the cell for editing. The problem is that excel does not increase the height of the row to make the rest of the sentence visible. Nor does the "Autofit" option for the row work.

The code that puts the long text is as follows.

Workbooks("Excelworkbook.xls").sheets(3).range("c3").value = "this is the long text that I want to insert into the cell through macro, but after inserting this text, I expect the cell to grow in height as I have the wordwrap setting set On, but still does not do it.....beside this, I even tried to autofit the row after the macro has been run, but only in vein....please also note that cells C3 to K3 are merged cells".

If anyone can help me solve this would be greatly appreciated.


Adjust The Tab Length In A Richtextbox
I don't know how adjust the tab length i a richtextbox.
I have checked the help but can't find anything about that.

Hoping for an answer as soon as possible

Adjust Size Of Picture Pasted Into Richtextbox??
I've used the windows API function SENDMESSAGE to paste a picture into a richtextbox. The problem is the picture size needs to be adjusted. I would like to adjust the picture size using code, and have it locked so the user cannot adjust it. Anyone have any ideas on how this could be done?


Line Adjust In A Picture Box
i hope you can help me
i print text a in a pixturebox like that

[quote]Private Sub Command1_Click()
Picture1.Print Text1.Text
End Sub

but in the picture box is not line adjustement. I show you a screenshot

how can align the text and them save a 4bit bitmap?

RichTextBox - Calculate Text Height
i need to calculate the height of text into a richtextbox VB6 control.

I've made a custom popup control that shows a long text.
I need to scroll the text with a scroll bar or with 2 arrows (it depends on configuration).
In order to do that i inserted the richtextbox into an image control and i changed the top value of richtextbox by scroll bar or by arrows.

This method works quite good but i need to know the height of the text to make it work properly.

If it isn't possibile to calculate the height of text of a richtextbox, do you know any other popup control to use?

Thank you to all, bye!!

Scroll Richtextbox Send Each Line To Another Richtextbox
Well this what I want to do, lets say I have a Multiline Richtextbox1 And I want to send each line from Richtextbox1 to Richtextbox2 one by one untyl it hits last line. And in doing so it keeps the RTF format of richtextbox1 in richtextbox2.

Like this will be the processes,
There 3 line in richtextbox1,
Take line 1 of richtextbox1 sends it to richtextbox2,
Take line 2 of richtextbox1 sends it to richtextbox2


How Can I Get Richtextbox Line And Richtextbox Line Count?
how can i get richtextbox line and richtextbox line count? i have the code to get textbox line and richtextbox line count (see below). but, it doesnot work for richtextbox control. what modification i want to make in the below code to work. help me....

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'Description: Get a line count for a Text Box
Global Const WM_USER = &H400
Global Const EM_GETLINE = &HC4

Function TextBoxLine(TB As TextBox, ByVal LineNO As Integer) As String
Const BUFLEN = 1028
Dim buffer As String * BUFLEN
' Set 1st 2 bytes to Buffer length
Mid(buffer, 1, 1) = Chr(BUFLEN And &HFF)
Mid(buffer, 2, 1) = Chr(BUFLEN &H100)
If Not TB.MultiLine Then
TextBoxLine = TB.Text
ret& = SendMessage(TB.hwnd, EM_GETLINE, LineNO - 1, ByVal buffer)
If ret& Then
TextBoxLine = Left$(buffer, ret&)
TextBoxLine = ""
End If
End If
End Function

Function TextBoxLinecount(TB As TextBox) As Integer
If TB.MultiLine Then
ret& = SendMessage(TB.hwnd, EM_GETLINECOUNT, 0, 0)
TextBoxLinecount = CInt(ret&)
TextBoxLinecount = 1
End If
End Function

Richtextbox : How To Change/set A Line Position To Move The Line Up/down?
I want to write a line in a Richttextbox at a specific desired Position vertically, like in a picturebox.

For a picturebox to change the print position

Private Sub Command1_Click()
Picture1.CurrentY = 100
Picture1.Print "test" ' this prints the text beginning from y axis of
' 100 pixels down.
End Sub
How can I do the same for a RTBox?
(I dont mean a newlinefeed.)

If there is a solution for this, then I should place a text in a RTBox at
any position.

Send Line By Line From A Richtextbox With Brake Between Each [Solved]
Here the program I have in mind

lets say my form has one richtext box. and the user types in the first line something then hits enter goes to the second line, ect....

How I for example make it so that, when the user hits a command button, it will messege the first line, then take a 1 second brake then send the second line take 1 second brake ect...

MsgBox "line 1"
delay (1)
MsgBox "line 2"
delay (1)
MsgBox "line 3"
delay (1)

ect... is it posible


Extract Line By Line Of String Freom RichTextBox ..
anyone know how to do this????

i hope to extract line by line from Rich Text Box..... just like how the "line input" works ....

i have search through the forum but no one ever done this

RichTextBox - HowTo Increase Selection's Font Width But Not Height
Is there any way to increase font width of a selection without increasing font height in a RichTextBox ?

Dynamically Increase The Height Of RichTextBox As The User Types The Text Help!!!
Hi all,

I have a RichTextBox control on the Form and want to increase the height (only height, not width) if the RichTextBox as the user types in some characters.

The RichTextBox will have some initial height and width but there will not be any scrollbars. When the size the string increases, I want to increase the height of the Scrollbar ar the runtime.

The major hiccup in this is that the user can do text formatting in the RichTextBox.

Please help.



Edited by - Sudeep Roy on 7/28/2005 5:16:59 AM

RichTextBox Reading Line By Line (urgent)
Hi All,

I have one richtextbox connected to my PBX using serial port. i am retrieving all data from PBX into my richtextbox. and the data is coming line by line. so i want to store one line in one row of my access database from the richtextbox.

i was try to much but i am failed. Please help me if some one have any idea.

thank you

Printing And Line Height

I have to position the following text on a printed page and I am using twips (let's not discuss that!)

Customer Name
Street 1
Street 2

If I print in 12 point, how far apart are the lines normally?

How about with an increase in font size.

Setting Line Height On LaserJet
Setting line height in DOS for LaserJet was simply sending the control code for vertical motion index. The Windows printer driver seems to strip the escape codes, so how do I set VMI? Setting horizontal spacing is simple - just set font size to any number such as 10.7 or 12.35, but I don't see how to do line height. (I have a program that automatically fits text files to optimum page fit and no. of pages)

How To Take Line By Line Words In Richtextbox
i want to know how to take line by line words in richtext box. and i want to store into array also. need help.

Richtextbox Help! (New Line/next Line Insertion)
How can i insert a new line/go to the next line on a richtext box? without pressing enter key..

How To Msgbox Richtextbox Line By Line?
Hi, what I want to do, lets say a richtextbox has 3 lines fill I want to msgbox each one separetly

I mean lets say the richtextbox has this

line 1
line 2
line 3

so the program will first msgbox line 1 then msgbox line 2 ect..

is there an easy way to do this?


Add A Line To RichTextBox
I need to add a line to a rich text box activex control.
After entering some text in the control i need to add a line at bottom. How can this be done? Using VB code.

Any Help or Links would be helpful,

Thanks in Advance,


New Line In Richtextbox?
I tried vbCrlf , and "{
}", but neither worked.


New Line In RichTextBox?
How do you move to the next line of a rich text box?

Line In A Richtextbox..
how would you go about putting a line/separator in a rich textbox??

EDIT : A horizontal one, I mean...

Richtextbox - Line
Dear all...

I have a richtext box, and as you know there is a line property, we can say go to line 1, or etc... my question is how do i make that line number appear. Make the line numbers visible.

Many thanks

Line Num-Richtextbox
Is there any way to put line number in the
left margin of the richtextbox.??

How to write the line numbers in the Richtextbox margins?

How all text editors implement the line number option?

I tried lot but nothing worked out.

any code snippets in any language would be

How Can I Take Frorm The RichTextBox The Column Numper Per Line And Line Numper
how can i take frorm the RichTextBox the column numper per line and line numper

thank you


Drawing A Line In A RichTextBox
I'd like to have a vertical line in a richtextbox which will indicate that a certain # of characters have been reached. I've tried the line tool but that wont move to the front, therefore it can't be seen at run-time.

Any suggestions?


Remove Line From A RichTextBox
How can I remove a specific line from a Richtextbox control?
I'm interested if there's a function that does this automatically or do I have to do it manualy?

Selecting A Line In RichTextBox
I have a RTB that has something like 50000 lines in it. I am needing to be able to highlight each line in the RTB, only one line at a time. I do not know how to highlight an entire line in the RTB. I also would like to know how to reference these lines. Thanks in advance for any light you can shed on the subject.

RichTextBox - Get Character From Line...

How can I get the number of the first character in line x...?

I need to know this because I'm making a notepad recreation, and I want to use the GoTo function.
In this function you need to enter a line number and the program will take you to that line.

I was planning to use the SelStart function of the RTB to do the actual "going there", but for that I obviously need to know the character number to go to...

I am now using the following, which is giving me some problems:
(RTB1 is the name of the RichTextBox)

Option Explicit
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Const EM_LINEINDEX = &HBB
Public Const EM_LINELENGTH = &HC1

Dim LineIndex as Long
Dim CharNr as Long

LineIndex = Val(Text1.Text)
CharNr = SendMessage(RTB1.hwnd, EM_LINEINDEX, LineIndex, 0&) - 1

RTB1.SelStart = CharNr

While this works, kinda, the problems are:

1. A minor problem - The character it returns is the last character in the specified line, not the first.

2. A major problem - This seems to count tabs as a new line aswell!
For example, if the RTB contained the following:

Hello! Here comes a tab! <-- That was a tab!
Then, if I specify LineIndex = 1, the cursor jumps to somewhere in the middle of the tab. If i specify LineIndex = 2, the cursor jumps to the end of (the same) line...!

Are there any other ways of doing this? Or how can I solve these problems?

Getting RichTextBox Line Properties
When using the selStart, selLength, selText to select and get the text from a rich text box is there a function that can get the properties of the selected text ( Font, size , color, etc)?


Copyright © 2005-08, All rights reserved