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 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 PostSatyam, I read your requirements a few times but came away that they were not complete. I might make a bet you didn't really mean to disable input once the 12 lines were hit but that you wanted to allow them to edit the first 12 and automatically discard line …
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,701 https://5calls.org Moderator
Santanu.Das 125 Santanu Das
Satyam_1 0 Junior Poster
Satyam_1 0 Junior Poster
Satyam_1 0 Junior Poster
rproffitt 2,701 https://5calls.org Moderator
Satyam_1 0 Junior Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Satyam_1 0 Junior Poster
rproffitt 2,701 https://5calls.org Moderator
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
rproffitt 2,701 https://5calls.org Moderator
Reverend Jim 5,225 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.