|
-
Aug 22nd, 2006, 01:45 PM
#1
Thread Starter
Addicted Member
[RESOLVED] spacses in rich text
hello
any body knows how can i add a space befor and after any symbol (such as (,) . - ....etc) in a rich text box
-
Aug 22nd, 2006, 01:55 PM
#2
Re: spacses in rich text
Do you mean like while typing or when you allready have the text and you would like to change it?
-
Aug 22nd, 2006, 01:57 PM
#3
Thread Starter
Addicted Member
Re: spacses in rich text
i mean if i alredy have the text
-
Aug 22nd, 2006, 02:01 PM
#4
Re: spacses in rich text
VB Code:
Dim i As Long
With RichTextBox1
.SelStart = 0
For i = -1 To Len(.Text)
.SelStart = .SelStart + 1
.SelText = " "
Next i
End With
-
Aug 22nd, 2006, 02:07 PM
#5
Thread Starter
Addicted Member
Re: spacses in rich text
thanks gavio for your fast reply
but this code adds spaces between all letters and i whant to add spaces between the symbols like ? \ . ;
for example if the text was :
Hello, where are you? please (call)
it will be:
Hello , where are you ? please ( call )
-
Aug 22nd, 2006, 02:13 PM
#6
Re: spacses in rich text
VB Code:
With RichTextBox1
.Text = Replace(.Text, ",", " , ")
.Text = Replace(.Text, "?", " ? ")
.Text = Replace(.Text, "\", " \ ")
.Text = Replace(.Text, ".", " . ")
.Text = Replace(.Text, ";", " ; ")
.Text = Replace(.Text, "(", " ( ")
.Text = Replace(.Text, ")", " ) ")
End With
EDIT: Or..
VB Code:
RichTextBox1.Text = Replace(Replace(Replace(Replace(Replace(Replace(Replace(RichTextBox1.Text, _
",", " , "), "?", " ? "), "\", " \ "), ".", " . "), ";", " ; "), "(", " ( "), ")", " ) ")
Last edited by jcis; Aug 22nd, 2006 at 02:18 PM.
-
Aug 22nd, 2006, 02:18 PM
#7
Thread Starter
Addicted Member
Re: spacses in rich text
Jcis
thanks alot thats it
-
Aug 22nd, 2006, 03:07 PM
#8
Re: spacses in rich text
bear in mind you'll lose any formatting if you use jcis's method
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|