S
Speebs
Hello,
I have a little form that people can fill out to generate CD labels
from an RTF template. The template basically contains variables that
are replaced by the text typed into the form.
I also have a "Preview" tab which will show a RichTextBoxcontaining
the output of the label generator (ie. the template, with the
variables replaced).
I am able to load the template into a RichTextBox without problems.
This gives me a RichTextBox containing a CD label with words like
%MIDDLE-LEFT% and the other variables.
Then I have the code below, which replaces the text with whatever is
in the user-edited textboxes (eg. txtMiddleLeft.Text):
This does not work. The variable tmpVar ends up with the correct,
updated data (I checked by copying it to the clipboard and pasting it
into a new RTF file- the variables were replaced). But the
RichTextBox still contains the template text. If I copy
txt_Preview.Rtf to the clipboard, it still contains the template data.
No errors are generated when I run the last line. Can someone please
help me! How should I be accomplishing this?
Note that I am not using PrintPreviewDialog because I need this to
appear inside an existing tab, and I also have not been able to get
PrintPreviewDialog to work properly (I have limited time for this
project).
Thank you.
I have a little form that people can fill out to generate CD labels
from an RTF template. The template basically contains variables that
are replaced by the text typed into the form.
I also have a "Preview" tab which will show a RichTextBoxcontaining
the output of the label generator (ie. the template, with the
variables replaced).
I am able to load the template into a RichTextBox without problems.
This gives me a RichTextBox containing a CD label with words like
%MIDDLE-LEFT% and the other variables.
Then I have the code below, which replaces the text with whatever is
in the user-edited textboxes (eg. txtMiddleLeft.Text):
Code:
txt_Preview.Rtf = templateRTFText // this works fine
tmpVar = Replace(templateRTFText, "%MIDDLE-LEFT%",
txtMiddleLeft.Text, , , CompareMethod.Text) // this works fine
txt_Preview.Rtf = "" // this works fine!
txt_Preview.Rtf = tmpVar // this does not work!
This does not work. The variable tmpVar ends up with the correct,
updated data (I checked by copying it to the clipboard and pasting it
into a new RTF file- the variables were replaced). But the
RichTextBox still contains the template text. If I copy
txt_Preview.Rtf to the clipboard, it still contains the template data.
No errors are generated when I run the last line. Can someone please
help me! How should I be accomplishing this?
Note that I am not using PrintPreviewDialog because I need this to
appear inside an existing tab, and I also have not been able to get
PrintPreviewDialog to work properly (I have limited time for this
project).
Thank you.