Counting Lines in RichTextBox

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 LongiLines = 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.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of