I have vb.net application and have a richtextbox..
I want set the lines limit to 12 and after 12 lines the user will not allow to enter text.
How can i do this?
Satyam_1
0
Junior Poster
Recommended Answers
Jump to PostThere are a few ways. Depending on the exact effect you want. My thought is the TextChanged event ( http://www.dotnetperls.com/textbox-vbnet ) would run a small Me.Text = 'code that strips the text to …
Jump to PostYou can use RTB.Lines.Count() method to get total lines number. It gives you the total count on every press of Return Key.
Jump to PostI'd use the simpler Me.Text = first 12 lines of text (your code goes here) to strip the rest. Your specification can be taken many ways. I'm reading that they can enter 12 lines, but you strip the rest.
Jump to Post@rproffitt - the code I suggested allows all of that. It says only to disallow any ENTER keys if already at the max allowed. All other keystrokes are still allowed.
@satyam_1 - please explain how the code does not meet your needs and I will try to modify it accordingly.
All 14 Replies
rproffitt
2,565
"Nothing to see here."
Moderator
Santanu.Das
125
Santanu Das
Satyam_1
0
Junior Poster
Satyam_1
0
Junior Poster
Satyam_1
0
Junior Poster
rproffitt
2,565
"Nothing to see here."
Moderator
Satyam_1
0
Junior Poster
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
Satyam_1
0
Junior Poster
rproffitt
2,565
"Nothing to see here."
Moderator
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
rproffitt
2,565
"Nothing to see here."
Moderator
Reverend Jim
4,780
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
Satyam_1
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.