473,672 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

counting lines of textbox

HDB
Ok. I have a windows form with a textbox for displaying certain messages.
Multiline=true and wordwrap=true. I want to know the amount of the lines
currently showing. That should not be any rocket-science, eh?

Textbox.lines.l ength() only returns the amount of lines ending with a 'hard'
CrLF, not the lines with a 'soft' CrLf done by the wordwrapping option. Why,
I don't know. I don't want to know how much lines are ending with 'hard'
CrLf. I want to know how much lines are currently displayed (and thus
depending on the horizontal size of the textbox). Anyone?
Nov 20 '05 #1
3 1448
* "HDB" <no***********@ donotspam.kpn.c om> scripsit:
Ok. I have a windows form with a textbox for displaying certain messages.
Multiline=true and wordwrap=true. I want to know the amount of the lines
currently showing. That should not be any rocket-science, eh?


I don't think that there is a managed way to do that. You may want to
take a look at this VB6 implementation:

<URL:http://www.activevb.de/tipps/vb6tipps/tipp0098.html>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Hi Herfried,

IMHO this conflicts with if you dock a textbox or make it in any other way
more sophisticated to the screen.

Therefore I did not want to answer this.

Cor
Nov 20 '05 #3
* "Cor Ligthert" <no**********@p lanet.nl> scripsit:
IMHO this conflicts with if you dock a textbox or make it in any other way
more sophisticated to the screen.

Therefore I did not want to answer this.


?!?

You can convert the soft like breaks into hard line breaks and then
count the number of lines. You don't need to change the content of the
textbox.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

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

Similar topics

5
2843
by: Anders K. Jacobsen [DK] | last post by:
Hi We have a rather large asp.net project with serveral utility projects (written in C#). Is there at tool out there which can give an estimate of the total amount of code lines all projects results in? thanks in regads Anders
1
6917
by: j | last post by:
Hi, I've been trying to do line/character counts on documents that are being uploaded. As well as the "counting" I also have to remove certain sections from the file. So, firstly I was working with uploaded MS WORD .doc files. Using code like that below: strLine = sr.ReadLine While Not IsNothing(strLine) 'Not eof If Trim(strLine) <> "" Then 'Not blank
3
3903
by: HDB | last post by:
Thanks for the responses in a former thread about getting the count of lines in a multiline textbox with wordwrap. After some tinkering, I found the solution (based on a VB6 solution, had to modify a bit for VB.NET): <DllImport("user32.dll")> Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32 End Function
5
7684
by: andy.lee23 | last post by:
hi im having trouble counting lines in a text file, i have the following code int node1, node2, i; char name; float value; ifstream fin; fin.open(OpenDialog1->FileName.c_str()); i=1;
4
2656
by: anoehre | last post by:
Hi! I have a multi-line text box in a compact framework c# application. I need a method to calculate the excact number of lines of the textbox and a method to calculate the number of used lines after the text box was filled with a string. Any ideas? Greetings,
4
1918
by: Dado | last post by:
I have a next situation with the textbox field: A - B = C 1. How to fill the A fill with the data from my previous recordset ? Can I do it with the expression builder ? 2. I want that every field I can edit or count, depends on what fileds I input the value ?
6
16845
by: =?Utf-8?B?SGFucyAtIERpYUdyYXBoSVQgLQ==?= | last post by:
Hi! sorry for a dumb question. I have a textbox where multiline=true and I want to set the scrolbar from none to vertical when the textbox have more then f.ex. 5 lines, or reverse. How can I count the amount of lines in a textbox? Best regards
7
2096
by: peraklo | last post by:
Hello, there is another problem i am facing. i have a text file which is about 15000 lines big. i have to cut the last 27 lines from that file and create a new text file that contans those 27 lines. and after that save both of those files... since that is a big block of text (15000 lines) i thint that it is a big job to look for a keyword... so my question is this exactly: how do i do this:
4
1268
by: Anthony P. | last post by:
Hello Everyone, I'm building an application and need to keep track of the amount of text in a textbox to make sure the user knows how many characters they have left to type. I've set the textbox's max length to 120 and that works fine. Now, I have a label that displays characters remaining in the textbox. For each keypress I am decrementing the counter (and label value) by one and when the user presses the backspace key, I am...
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8680
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.