473,651 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

count lines of text

I need to limit multiline textbox to 3 lines of text and if there are less
then 3 lines when leaving, add empty line holders. How can I do this??

Thanks,
paul
Nov 20 '05 #1
23 2726
* "Paul Mars" <pa******@netze ro.com> scripsit:
I need to limit multiline textbox to 3 lines of text and if there are less
then 3 lines when leaving, add empty line holders. How can I do this??


'TextBox1.Lines .Length' will return the number of lines.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Thanks,
Paul
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eD******** ******@TK2MSFTN GP09.phx.gbl...
* "Paul Mars" <pa******@netze ro.com> scripsit:
I need to limit multiline textbox to 3 lines of text and if there are less then 3 lines when leaving, add empty line holders. How can I do this??


'TextBox1.Lines .Length' will return the number of lines.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #3
What event should I put limit to 3 lines under??

Thanks again,
paul
"Paul Mars" <pa******@netze ro.com> wrote in message
news:OI******** *****@TK2MSFTNG P11.phx.gbl...
Thanks,
Paul
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:eD******** ******@TK2MSFTN GP09.phx.gbl...
* "Paul Mars" <pa******@netze ro.com> scripsit:
I need to limit multiline textbox to 3 lines of text and if there are less then 3 lines when leaving, add empty line holders. How can I do this??


'TextBox1.Lines .Length' will return the number of lines.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


Nov 20 '05 #4
* "Paul Mars" <pa******@netze ro.com> scripsit:
What event should I put limit to 3 lines under??


Maybe in the 'TextChange' event. You can use an ErrorProvider to make
the user aware of invalid (longer) input.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
I would count the number of characters that make up the three lines, place
that in the designer window as the max number of characters allowed, and
then on submit or whatever it is that you are doing count the number of
characters in the textbox and add characters as you see fit when it is less
than desired.

"Paul Mars" <pa******@netze ro.com> wrote in message
news:uu******** ******@tk2msftn gp13.phx.gbl...
I need to limit multiline textbox to 3 lines of text and if there are less
then 3 lines when leaving, add empty line holders. How can I do this??

Thanks,
paul

Nov 20 '05 #6
Hi Scorpion53061,
I would count the number of characters that make up the three lines, place
that in the designer window as the max number of characters allowed, and
then on submit or whatever it is that you are doing count the number of
characters in the textbox and add characters as you see fit when it is less
than desired.

Wouldn't that only work if the text box is using a non-proportional font for
the display (which one would seldom choose, as it looks like h*)?

-- Cindy

Nov 20 '05 #7
Different characters take up different amount of space. As
www=3
iiiiiii=7
"scorpion53 061" <sc************ *************** *@yahoo.com> wrote in message
news:eq******** *****@TK2MSFTNG P11.phx.gbl...
I would count the number of characters that make up the three lines, place
that in the designer window as the max number of characters allowed, and
then on submit or whatever it is that you are doing count the number of
characters in the textbox and add characters as you see fit when it is less than desired.

"Paul Mars" <pa******@netze ro.com> wrote in message
news:uu******** ******@tk2msftn gp13.phx.gbl...
I need to limit multiline textbox to 3 lines of text and if there are less then 3 lines when leaving, add empty line holders. How can I do this??

Thanks,
paul


Nov 20 '05 #8
yup.

"Cindy M -WordMVP-" <C.*********@hi speed.ch> wrote in message
news:VA.0000900 a.00e50f19@spee dy...
Hi Scorpion53061,
I would count the number of characters that make up the three lines, place that in the designer window as the max number of characters allowed, and
then on submit or whatever it is that you are doing count the number of
characters in the textbox and add characters as you see fit when it is less than desired.
Wouldn't that only work if the text box is using a non-proportional font

for the display (which one would seldom choose, as it looks like h*)?

-- Cindy

Nov 20 '05 #9
I want to stop the user, if s/he tries to start a 4th line. Not tell her/him
after the 4th and maybe more lines are entered.

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
* "Paul Mars" <pa******@netze ro.com> scripsit:
What event should I put limit to 3 lines under??


Maybe in the 'TextChange' event. You can use an ErrorProvider to make
the user aware of invalid (longer) input.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #10

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

Similar topics

22
61369
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: in_file = raw_input("What is the name of the file you want to open: ") in_file = open("test.txt","r")
1
3142
by: JD | last post by:
Hi guys I'm trying to write a program that counts the occurrences of HTML tags in a text file. This is what I have so far: #include <stdio.h> #include <stdlib.h> #include <string.h> #define MB 1048576
14
23222
by: mesterak | last post by:
I want to very quickly count the number of lines in text files without having to read each line and increment a counter. I am working in VB.NET and C#. Does anyone have a very fast example on how to do this? Thanks, Matt
3
2183
by: javanooby | last post by:
Hi, I am having problems with this bit of code: public class main { public class readAccounts { reader1 r = new reader1();
1
5634
by: BEETHOVEN | last post by:
Is there a way to count how many lines are in a text box on a Access 97 report? I have a report that has a text box and sometimes the box will be 2 lines long and sometimes 3 lines long. I need some other text boxes to adjust depending on how many lines are in the text box. Below is some code I found in this forum but does not work. It does not matter if I use a CR (Carriage return) Chr$(13) or LF (Linefeed) Chr$(10) or both. Dim n...
8
3738
by: shivam001 | last post by:
I have the following file as the input APPLE 0 118 1 110 1 125 1 135 2 110 3 107 3 115 3 126 ORANGE 0 112 1 119 2 109 2 119 3 112 4 109 4 128 MANGO 0 136 1 143 2 143 3 143 4 136 BANANA 0 5 1 12 1 15 2 13 3 6 3 9 I need to read the above file and have the following information in the output file In APPLE 0 occurs 1 time, 1 occurs 3 times, 2 occurs 1 time, 3 occurs 3 times
3
2705
by: waynejr25 | last post by:
can anyone help me add a function that will count the occurance of each word in an input file. here's the code i have so far it counts the number of characters, words, and lines but i need the occurance of each word. #include <fstream> #include <iostream> #include <string> #include <cstdlib> using namespace std;
16
4428
by: lovecreatesbea... | last post by:
It takes mu so time to finish this C source code line count function. What do you think about it? / ******************************************************************************* * Function : size_t linecnt(char *filenm); * Author : jhlicfoocbar@gmail.com, remove foobar for email * Date : 2008.4.12 * Description: C source code line count. No comments & no space lines
9
13206
by: NvrBst | last post by:
Whats the best way to count the lines? I'm using the following code at the moment: public long GetNumberOfLines(string fileName) { int buffSize = 65536; int streamSize = 65536; long numOfLines = 0; byte bArr = new byte;
0
8349
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8795
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8695
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
8460
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
8576
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
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2696
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
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.