473,379 Members | 1,367 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,379 software developers and data experts.

number of lines in Richtextbox

If the user types some text into a rich textbox, i need to know how many
lines there are in the control.
Note, I'm not interested in counting the number of the carriage returns or
line feeds.

Suppose, the rich text is the height of a textbox (can view only one line at
a time), then if the user keeps typing and word wrap = TRUE and multi line =
TRUE, then it goes to the new line.
What i'd like to do is to automatically increase the height of the rich
textbox control to display all the text (increasing the height of the
control as and when needed).
But by default the height will be for one row (one line only).

How can i do this?
Jan 9 '06 #1
9 11177
Hi

RichTextBox1.Lines.Length should get you the number of lines

Hth, greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"LeAnne" <An**@bogusemail.com> schreef in bericht
news:OY**************@TK2MSFTNGP15.phx.gbl...
If the user types some text into a rich textbox, i need to know how many
lines there are in the control.
Note, I'm not interested in counting the number of the carriage returns or
line feeds.

Suppose, the rich text is the height of a textbox (can view only one line at a time), then if the user keeps typing and word wrap = TRUE and multi line = TRUE, then it goes to the new line.
What i'd like to do is to automatically increase the height of the rich
textbox control to display all the text (increasing the height of the
control as and when needed).
But by default the height will be for one row (one line only).

How can i do this?

Jan 9 '06 #2
"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
RichTextBox1.Lines.Length should get you the number of lines


This property will actually return the number of physical lines, not the
number of lines shown on the screen.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 9 '06 #3
Hi Herfried, I see what you mean, I was to fast reading the op's post.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:#r*************@TK2MSFTNGP12.phx.gbl...
"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
RichTextBox1.Lines.Length should get you the number of lines


This property will actually return the number of physical lines, not the
number of lines shown on the screen.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 9 '06 #4
Forget my first answer, this example by Herfried should help you

http://groups.google.be/group/micros...s.vb/msg/dc907
1779b6c7e98
hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Peter Proost" <pp*****@nospam.hotmail.com> schreef in bericht
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi Herfried, I see what you mean, I was to fast reading the op's post.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:#r*************@TK2MSFTNGP12.phx.gbl...
"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
RichTextBox1.Lines.Length should get you the number of lines


This property will actually return the number of physical lines, not the
number of lines shown on the screen.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


Jan 9 '06 #5
Peter,

"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
Forget my first answer, this example by Herfried should help you

http://groups.google.be/group/micros...s.vb/msg/dc907
1779b6c7e98


;-)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 9 '06 #6
Herfried, it's my first day at work after a two week holiday :-) so maybe
that explains something ;-)

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:ea**************@TK2MSFTNGP11.phx.gbl...
Peter,

"Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
Forget my first answer, this example by Herfried should help you

http://groups.google.be/group/micros...s.vb/msg/dc907 1779b6c7e98


;-)

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Jan 9 '06 #7
Peter,

We saw it, there was somebody asking something with the nick PeterPr however
I was in doubt if it was you and therefore I did not taken that time in it
as it was if it was you.

Cor
Jan 9 '06 #8
That indeed wasn't me, and it was an awfully long question like I liked to
post them when I first started using the ng :-)

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"Cor Ligthert [MVP]" <no************@planet.nl> schreef in bericht
news:uk**************@TK2MSFTNGP09.phx.gbl...
Peter,

We saw it, there was somebody asking something with the nick PeterPr however I was in doubt if it was you and therefore I did not taken that time in it
as it was if it was you.

Cor

Jan 10 '06 #9
Beautiful mate, worked like a charm...

"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:uT**************@TK2MSFTNGP14.phx.gbl...
Forget my first answer, this example by Herfried should help you

http://groups.google.be/group/micros...s.vb/msg/dc907
1779b6c7e98
hth Greetz Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Peter Proost" <pp*****@nospam.hotmail.com> schreef in bericht
news:ur**************@TK2MSFTNGP12.phx.gbl...
Hi Herfried, I see what you mean, I was to fast reading the op's post.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to
produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:#r*************@TK2MSFTNGP12.phx.gbl...
> "Peter Proost" <pp*****@nospam.hotmail.com> schrieb:
> > RichTextBox1.Lines.Length should get you the number of lines
>
> This property will actually return the number of physical lines, not
> the
> number of lines shown on the screen.
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://classicvb.org/petition/>
>



Jan 10 '06 #10

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

Similar topics

7
by: Melissa | last post by:
I'm trying to create a function that I can put in a query field that will consecutively number the records returned by the query starting at 1 and will start at 1 each time the query is run. So far...
18
by: Vasilis Serghi | last post by:
Presently I define the number of lines to be expected in a file when defining the array size and the initialisation of this array. This works fine for now, but i'm sure that in the future this...
4
by: M O J O | last post by:
Hi, I'm using a RichTextBox with WordWrap=True and MultiLine=False. When the text is to long, it fills more lines. How do I get the number of lines the text uses? Thanks!
54
by: MLH | last post by:
I use A97 and do not always insert line numbers while writing procedures. I find it necessary to go back and add them later to aid in debugging. Nearly 3 years ago, something was mentioned in...
19
by: eric.nave | last post by:
this is a slight change to a fequently asked question around here. I have a table which contains a "sortorder" column where a user can specify some arbitrary order for records to be displayed in. ...
2
by: aemihal | last post by:
Hello, I have a RichTextBox that has a large number of lines, well in excess of the amount that can be seen without scrolling. Upon an event, such as clicking a button, I would like to move the...
0
by: Vimalathithan | last post by:
Hi Every one, I have developing the user control with RichTextBox in C# windows application. The problem is when I paste any text inside the RichTextBox at the runtime the pasted lines not in...
0
by: StanislavPetrov | last post by:
How to get the number of the current line in a RichTexBox?I mean the line under the mouse cursor.
2
by: macky caliston | last post by:
Hi, Im having problems with the value being returned by the richtextbox.GetLineFromCharIndex method. Its returning a value that is more than the richtextbox.Lines.Length. Im trying to print...
4
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a multiline RichTextBox that I use for data logging. I'm concerned about how the AppendText method reacts when over time the maximum number of characters have been added. Do the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.