I have a textarea with more than 50,000 characters. There are several words in bold in the text.
How can I select only the bold words ?
Now I am using the code :
'TA is a textarea
'ListB is a Listbox
Dim Place As Integer, Start As Integer, BoldText As string
Start = 0
BoldText = “”
For Place = 1 to TA.Text.Len
TA.SelStart = Place
TA.SelLength = 1
if TA.SelBold = True then
If Start = 0 Then
Start = Place
End If
BoldText = BoldText + TA.SelText
Else
If Start > 0 Then
ListB.AddRow(Format(Start,“0000000”), Trim(BoldText))
Start = 0
BoldText = “”
End If
end if
Next
Dim count As Integer
count = TextArea1.StyledText.StyleRunCount //get the number of StyleRuns
For i As Integer = 0 To count-1 //loop through them
ListBox1.AddRow(Str(TextArea1.StyledText.StyleRunRange(i).StartPos))
ListBox1.Cell(i,1) = Str(TextArea1.StyledText.StyleRunRange(i).Length)
ListBox1.Cell(i,2) = TextArea1.StyledText.StyleRun(i).Text
Next
This works just fine.
But how can I know which parts of the text are in bold ?
In the listbox, I see no differences