S
Sam
I'm working on a MailMerge. I have a few simple (I hope) questions to
have my merge to work the way I want.
I have a RichTextBox that has the text in it, with strings like
<<NAME>> that I will need to replace for each row. This is what I
have so far:
'rtbBox is the RichTextBox on the form.
'rtbPrint is the RichTextBox that will be used for printing
'Save the data to a temp RichTextBox, since I need to see <<NAME>>
'for each row.
Dim row As DataRow
Dim rtbTemp As New MyRichTextBox
For Each row In g_dtTable.Rows
rtbTemp.Rtf = rtbBox.Rtf
rtbTemp.Rtf = rtbTemp.Rtf.Replace("<<NAME>>", _
row.Item("Name"))
rtbTemp.Rtf = rtbTemp.Rtf.Replace("<<AGE>>", _
row.Item("Age"))
'I need here to tack on the formated text from
'rtbTemp to rtbPrint
'and insert a pagebreak.
'I've tried rtbPrint.Text &= rtbTemp.Text, but that
'doesn't keep the formatting
'I've tried rtbPrint.Rtf &= rtbTemp.Rtf, but that doesn't
'seem to do anything.
Next
PrintDocument1.Print()
OK. Here are my questions
1. How do you copy text (including it's formatting) and append it to
the END of a DIFFERENT RichTextBox.
2. How do you append a page return to the END of a RichTextBox
Thanks for any help...
have my merge to work the way I want.
I have a RichTextBox that has the text in it, with strings like
<<NAME>> that I will need to replace for each row. This is what I
have so far:
'rtbBox is the RichTextBox on the form.
'rtbPrint is the RichTextBox that will be used for printing
'Save the data to a temp RichTextBox, since I need to see <<NAME>>
'for each row.
Dim row As DataRow
Dim rtbTemp As New MyRichTextBox
For Each row In g_dtTable.Rows
rtbTemp.Rtf = rtbBox.Rtf
rtbTemp.Rtf = rtbTemp.Rtf.Replace("<<NAME>>", _
row.Item("Name"))
rtbTemp.Rtf = rtbTemp.Rtf.Replace("<<AGE>>", _
row.Item("Age"))
'I need here to tack on the formated text from
'rtbTemp to rtbPrint
'and insert a pagebreak.
'I've tried rtbPrint.Text &= rtbTemp.Text, but that
'doesn't keep the formatting
'I've tried rtbPrint.Rtf &= rtbTemp.Rtf, but that doesn't
'seem to do anything.
Next
PrintDocument1.Print()
OK. Here are my questions
1. How do you copy text (including it's formatting) and append it to
the END of a DIFFERENT RichTextBox.
2. How do you append a page return to the END of a RichTextBox
Thanks for any help...