steve_w Level: Moderator

 Registered: 18-04-2003 Posts: 1156
|
Re: Text Box Formatting in Forms
Sorry I think with your 54 table search unless you change your db design. But regarding the high light you can use the "microsoft rich text box" control and the code below.
Private Sub Command1_Click()
RichTextBox1.Text = "The main problem I have is I want to highlight out where the word occurs in the text. Basically what i'm asking is if there's a way of highlighting a single word from a text box by either underlining it or making it bold."
End Sub
Private Sub Command2_Click()
Dim position As Integer
Dim SearchWord As String
SearchWord = "Highlight"
position = InStr(LCase(RichTextBox1.Text), LCase(SearchWord))
Do While position > 0
With RichTextBox1
.SelStart = position - 1
.SelLength = Len(SearchWord)
.SelBold = True
.SelUnderline = True
.SelColor = vbRed
.SelStart = Len(.Text)
.SelLength = 0
End With
position = InStr(position + 1, LCase(RichTextBox1.Text), LCase(SearchWord))
Loop
End Sub |
Steve
[Edited by steve_w on 18-10-2005 at 02:52 PM GMT]
|