first let me start by posting code..
rtb is a rich text box that i'm declaring for my entire form.. It is actually an instance of a Richtextbox but derived from a class i found that allows adding of links. (hence the "InsertLink()" )
Any Here is my problem: I'm trying parse the text in the rtb for strings that look like {xxxxx}. When i find them, I want to removed the plain text {xxxxx} AND send it to my InsertLink() method. What run into is a problem when i have two items (eg. {xxxxx} and {yyyyyy}) in the textbox. I've been able to remove the plain text and insert a link with only one, but when i have two the rtf format gets messed up and the first link goes away.
it happens when i do rtb.text = String .. that takes away the rtf data thus taking away all my links excpet for my last one.
I'm looking for a line of code or lines.. that lets me .Remove("{xxxxxx}") from my rtb.rtf rather than from my rtb.text..
Thanks in advance for any help that is provided..
Please just call me an idiot if i'm being to unclear : p
Tom
VB.NET:
Private Sub checkforlinks(ByVal text As String)
Dim re As New Regex("{\w+}")
Dim m As Match = re.Match(text)
While m.Success = True
rtb.InsertLink(m.ToString, m.Index)
m = m.NextMatch
End While
End Sub
rtb is a rich text box that i'm declaring for my entire form.. It is actually an instance of a Richtextbox but derived from a class i found that allows adding of links. (hence the "InsertLink()" )
Any Here is my problem: I'm trying parse the text in the rtb for strings that look like {xxxxx}. When i find them, I want to removed the plain text {xxxxx} AND send it to my InsertLink() method. What run into is a problem when i have two items (eg. {xxxxx} and {yyyyyy}) in the textbox. I've been able to remove the plain text and insert a link with only one, but when i have two the rtf format gets messed up and the first link goes away.
it happens when i do rtb.text = String .. that takes away the rtf data thus taking away all my links excpet for my last one.
I'm looking for a line of code or lines.. that lets me .Remove("{xxxxxx}") from my rtb.rtf rather than from my rtb.text..
Thanks in advance for any help that is provided..
Please just call me an idiot if i'm being to unclear : p
Tom