I've created a winform in VB 2008 Express Ed. The form has 4 text boxes... NAME / ADDRESS / TEL / Dob
These text boxes are spread out over 4 Tab-pages, each tab page has a NEXT (Button) to jump to the next tab... the 5th Tab page has an RTF box (docked)
On the 4th Tab,,, if I click on END button... it jumps to tab 5 & also loads a pre-saved RTF file into the RTF box from c:\folder\ (see Snippet ID=473725) for reference. The RTF file was created in Ms Word 2003, which has a table on it with rows/columns... please see 'original RFT' (File ID=217813) attachment image for guidance.
NOW: this is where the problem lies...
I want to replace letters (e.g. NNNNN) which are embedded in the saved RTF file, with the text from Textbox1.text on the 1st tab, and repeated for each textbox on each Tab.
If I just wish to load the saved RTF file into the RTF box... then it looks like (attachmemt: frm-001.JPG (34 KB)File ID=217819)... which is not my total objective...
If Button 4 "END"... if clicked... with the following code adding to Button 4:
' Detect & Replace
"nnnnn") > 0 Or RichTextBox1.Text.IndexOf(
"NNNNN") >= 0 Then
RichTextBox1.Text = RichTextBox1.Text.Replace(
it alters the RTF box (see attachment: frm-002.JPG (30 KB)File ID=217820)... I wish to keep the format of the RTF and replace NNNNN with the textbox1.text, but keep the row/columns.
I hope this hasn't totally confused you by now.
Please help :)
Private Sub Btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn4.Click
(Me.TabControl1.SelectedTab = Me.TabPage5)
Dim ESOLIAF As String = "form.rtf"
If Len(Dir("c:\folder\form.rtf")) > 0 Then
RichTextBox1.RightMargin = 0
RichTextBox1.Text = "File not found"