?
Solved

How to transfer 5 text boxes to 1 RTFbox and 1 of them in Italic?

Posted on 2003-02-25
5
Medium Priority
?
243 Views
Last Modified: 2010-04-17
I need to select a text in RTF text box in order to afterwards make that selection in italic.
My idea is to have like 5 text boxes, all will be toghether, but box number 3 will be italic.
Each time I click Insert button, an RTF box will have Box1 & box2 & box3... but number 3 is in italic.
Anyone can help me?

This is the code I've tried:

Private Sub Insert_Click()
italicfinder$ = txt3.Text
newline$ = Chr(13) + Chr(10)
frmMain.rtfBox.Text = frmMain.rtfBox.Text & txt2.Text & "." & txt3.Text & txt4.Text & txt5.Text & newline$
Dim foundpos As Integer
foundpos = frmMain.rtfBox.Find(italicfinder$, , , rtfWholeWord)
If foundpos <> -1 Then
frmMain.rtfRefs.Span " ", True, True
frmMain.rtfRefs.SelBold = True
Else
MsgBox "Not found"
End If
End Sub

This doesn't work.
Maybe there is another way to have those in the RTFBox and each time i click insert more will go into the new line (always with textbox 3 italic)

Thanks to everyone!
0
Comment
Question by:Shaolao
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 3

Expert Comment

by:Da_Weasel
ID: 8019752
When adding txt3.Text to the rtfBox put a space infront and behind it if you are going to use rtfWholeWord option.
0
 
LVL 1

Expert Comment

by:Smashmad
ID: 8023033
Dont yo said Italic? why do you write
frmMain.rtfRefs.SelBold = True
it is:
frmMain.rtfRefs.SelItalic = True
0
 
LVL 1

Expert Comment

by:Smashmad
ID: 8023091
Dont yo said Italic? why do you write
frmMain.rtfRefs.SelBold = True
it is:
frmMain.rtfRefs.SelItalic = True
0
 
LVL 1

Accepted Solution

by:
Smashmad earned 200 total points
ID: 8023121
My RichTextBox is called Rich
Text1, text2, text3, text4, text5 are the textBoxes
I use seltext, so i dont erase the old format..
Try it:

'--------------------------
Dim n As Integer
Rich.SelStart = Len(Rich.Text)
Rich.SelText = Text1 & Text2 & "."
n = Len(Rich.Text)
Rich.SelStart = n
Rich.SelText = Text3 & Text4 & Text5 & vbCrLf

Rich.SelStart = n
Rich.SelLength = Len(Text3)
Rich.SelItalic = True
Rich.SelLength = 0 'quit this line if yo want text3 selected
0
 

Author Comment

by:Shaolao
ID: 8025436
It works perfectly.
I've tried an implementation like this one before but I didn't get it to work. Thank you!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question