I have this code attached to a button
If htmlText.Contains("<frame src='demo.html'/>") Then
htmlText = htmlText.Text.Replace("<frame src="demo.html/>", "<frame src='" &
OpenStory.FileName)
End If
and what i want it to do is find the “frame src=’demo.html’/>” text in the hidden rhichtextbox which it’s text is loaded from the OpenFileDialog and replace the ‘demo.html’ with the filename of the specified file from the OpenFileDialog.
I know that there’s lots of errors and you can see them if you copy into vb but i can’t figure it out. thanks heaps in advance for all your help 🙂
If
htmlTextis aRichTextBoxcontrol, your code should be changed like this:If
htmlTextis a string variable, your code should be changed like this:Your posted code has issues because you are not matching the strings correctly. You are testing for a string called ‘demo.html’ with single quotes but trying to change it by looking for “demo.html” with double quotes.
You are also trying to replace it with the OpenStory.FileName without a closing quote or closing bracket, which would mess up the existing HTML format.
As you can see from my answer, I can’t figure out what
htmlTextis, because if it’s a string, string’s don’t have aTextproperty, but aRichTextBoxcontrol does haveTextproperty. But then again, callingContainson aRichTextBoxmakes it search for a Control, not a string.