A
Allen
Hello. I have a windows form which contains a RichTextBox control,
rtNotes. At runtime this is filled with some data from a datatable using
the following code:
Dim sFont As New Font(rtNotes.Font, FontStyle.Regular)
Dim bFont As New Font(rtNotes.Font, FontStyle.Bold)
For Each dr As DataRow In dt.Rows
'this sets the first part to be bold
rtNotes.SelectionFont = bFont
rtNotes.Text = rtNotes.Text & dr("DateEvent").ToString & " " &
dr("AgendaCode").ToString & " " & dr("PartyName").ToString & vbCrLf
'this sets it back to standard
rtNotes.SelectionFont = sFont
rtNotes.Text = rtNotes.Text & dr("TranText").ToString & vbCrLf
& dr("longnote").ToString & vbCrLf & vbCrLf
Next
I am trying to get the first line of the text to be BOLD and the rest of
the note to be standard text. However, when I view the RichTextBox, all of
teh text is in standard font. I have also tried changing the
..SelectionFont to just .Font with the same result. How can I get teh first
line of each record to be bold?
TIA
--
ats@jbex
It's easy to lay down and hide
Where's the warrior without his pride?
Adam and The Ants - Dog Eat Dog
rtNotes. At runtime this is filled with some data from a datatable using
the following code:
Dim sFont As New Font(rtNotes.Font, FontStyle.Regular)
Dim bFont As New Font(rtNotes.Font, FontStyle.Bold)
For Each dr As DataRow In dt.Rows
'this sets the first part to be bold
rtNotes.SelectionFont = bFont
rtNotes.Text = rtNotes.Text & dr("DateEvent").ToString & " " &
dr("AgendaCode").ToString & " " & dr("PartyName").ToString & vbCrLf
'this sets it back to standard
rtNotes.SelectionFont = sFont
rtNotes.Text = rtNotes.Text & dr("TranText").ToString & vbCrLf
& dr("longnote").ToString & vbCrLf & vbCrLf
Next
I am trying to get the first line of the text to be BOLD and the rest of
the note to be standard text. However, when I view the RichTextBox, all of
teh text is in standard font. I have also tried changing the
..SelectionFont to just .Font with the same result. How can I get teh first
line of each record to be bold?
TIA
--
ats@jbex
It's easy to lay down and hide
Where's the warrior without his pride?
Adam and The Ants - Dog Eat Dog