Link to home
Start Free TrialLog in
Avatar of BarryTang
BarryTang

asked on

How can I avoid the split of word ?

I would like to input a long text string into richtextbox ( or text box ) as follows :

     richtextbox1.text = str1

I don't want to split a word and display in two lines. How can I do that ?
Avatar of Valliappan AN
Valliappan AN
Flag of India image

Normally, textbox won't wrap text, unless you set MultiLine property to true.

In Richtextbox, you can do that by setting the rightmargin to a larger value like this:

Richtextbox1.RightMargin = 50000

and you can set its scrollbars property to Both or Horizontal as need be.

Regards.
Avatar of sazhagianambi
sazhagianambi

Hi,

In Both TextBox and RichTextBox Controls there is a Prperty Called Multilne. Set that to False. So I didn't allow u to Wrap Text.


Regards,
Nambi
Hi,

In Both TextBox and RichTextBox Controls there is a Prperty Called Multilne. Set that to False. So I didn't allow u to Wrap Text.


Regards,
Nambi
ya, sazhagianambi is right that Multiline property is there in both. But if with Multiline set to true, in RTB and still you want a longer length of line to be displayed without wrapping, then you can set the rightmargin property to a larger value as already mentioned by me.

Cheers

Avatar of BarryTang

ASKER

Actually my requirement is to use multiline display and find out if there is simple solution so that a word will not split into two parts.

Since my text is very long so that it is not good for the user to scroll if display on just one line.

Barry
Hi,

If the Length Of Word Exceeds the RichtextBox's Width It automatically Split the Word.

If the Length Of Word Wquals to the RichtextBox's Width It Simply accomadates that Word.

So U Must Find Out the Max Length Of the Word in Your Strig and assign that value to RichTextBox's Width.

I Hope this Will Solve Your Problem. Possible i'll Post Code for that Very soon.

Regards,
Nambi
Just changing the RTB width will not solve it I suppose, but the RightMargin property of RTB to be increased as already suggested by me and set the MultiLine to True (which is default in RTB I suppose).

Hope that helps.
BarryTang,
You have 17 opened questions as of this date.  
I will be posting in each of these questions.  
Please take care of your opened questions older than 30 days by clicking on your logon name link and looking for UnlockedQ or using the links I am providing below.  
Please finalize these within 72 hours or I will ask administration to look into your account at that point.  If you have questions, please ask and I will provide assistance.  

https://www.experts-exchange.com/questions/20187331/Problem-related-to-Unknown-token-received-from-SQL-Server.html
https://www.experts-exchange.com/questions/20133725/Access-Foxpro-2-6-free-tables-from-SQL-server-2000.html
https://www.experts-exchange.com/questions/20088012/Problem-related-to-insert-a-group-of-record-to-a-data-file.html
https://www.experts-exchange.com/questions/20083509/Connection-Failure-using-local-harddisk.html
https://www.experts-exchange.com/questions/20382035/How-can-I-extract-a-music-track-in-a-midi-file-by-DirectMusic-in-VB.html
https://www.experts-exchange.com/questions/20382294/How-can-I-extract-a-music-track-in-a-midi-file-by-DirectMusic-in-VB.html
https://www.experts-exchange.com/questions/20534626/DLL-Function-can-run-in-exe-but-fail-to-run-in-VB6-environment.html
https://www.experts-exchange.com/questions/20521771/How-can-I-avoid-the-split-of-word.html
https://www.experts-exchange.com/questions/20515842/Can-I-use-this-DLL-in-VB6.html
https://www.experts-exchange.com/questions/20513575/Problem-related-to-shell-wait.html
https://www.experts-exchange.com/questions/20493221/Problem-related-to-the-scroll-value.html
https://www.experts-exchange.com/questions/20436510/How-can-I-made-a-form-on-top-but-will-disappear-when-switch-to-screen-of-other-windows-task.html
https://www.experts-exchange.com/questions/20399960/How-to-use-a-C-dll-in-a-VB6-program.html
https://www.experts-exchange.com/questions/20395868/How-to-play-a-specific-frequency-of-wave-sound-out.html
https://www.experts-exchange.com/questions/20375410/How-can-I-display-special-characters-in-VB-controls.html
https://www.experts-exchange.com/questions/20373966/How-to-display-musical-note-from-midi-file-in-a-VB-program.html
https://www.experts-exchange.com/questions/20372811/How-to-use-DLL-in-my-VB-program.html

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial