Getox Posted September 14, 2005 Posted September 14, 2005 (edited) I have a Rich textbox and have some text in it, What im trying to do is when the user selects text and clicks a button it will replace that selected text with something like <tag>{selected text}</tag> How would i do this? EDIT-------------------------------------------------------------------- Ok well i got what i wanted after playing around with the code for a while, Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click codebox.Copy() tmptext.Paste() formattext.Text = "<b>" + tmptext.Text + "</b>" formattext.Select() formattext.Copy() codebox.Paste() formattext.Clear() tmptext.Clear() End Sub But if anyone knows a better way, Please do tell me. Edited September 14, 2005 by Getox Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Machaira Posted September 14, 2005 Posted September 14, 2005 This might be an easier way: formattext.SelectedText = "<b>" + tmptext.Text + "</b>" :) Quote Here's what I'm up to.
Getox Posted September 15, 2005 Author Posted September 15, 2005 Oh thats great, theres a heap of code replaced by 1 line of code :) I edited it a bit heres the code: codebox.SelectedText = "<b>" + codebox.SelectedText + "</b>" Quote Page Edit 2.0 Alpha 2 OUT NOW! - Download Now -
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.