Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: 95/98
Expertise: Beginner
Dec 13, 1996

Counting Lines in RichTextBox

Question:
I want to develop a word-processor with VB 4.0 and the RichTextBox. I've got all the functions like bold, italic etc. but I'm missing a function to count the pages. Is there any function in VB 4.0 to count the pages or do I have do write my own function?

Answer:
After checking the RichTextBox help, the only thing I found was the GetLineFromChar method. It tells you what line a particular character number is. You could do something like this:

Dim iLines as Long

iLines = RichTextBox.GetLineFromChar(Len(RichTextBox.Text))
That should give you the total number of lines in the document. You can then divide that by 66 or however many lines there are on your page, with a given font size.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date