HI ..
I have some text in a textbox. and I want to allow a user to select some text and convert it to BOLD by clicking a button.
Is there away to capture what user selected once the user clicked a button.
Thank you,
HI ..
I have some text in a textbox. and I want to allow a user to select some text and convert it to BOLD by clicking a button.
Is there away to capture what user selected once the user clicked a button.
Thank you,
To get the selected text in a textbox, you need to use a combination of the SelectionStart and SelectionLength properties.
But I don't think a textbox is going to work for you. TextBoxes don't allow the sort of formatting you are wanting to do. You can make the entire thing bold, but not part of it bold and the other part normal.
I think you will need to check out hte RichTextBox instead.
Regards
Thank you for the reply.
I am doing this in a web application. and RichTextBox is a Windows.Form component.
So What I did I added a reference "System.Windows.Form" and wrote this code to display the component on the web
RichTextBox richTextbox =
new RichTextBox(); this.Controls.Add(richTextbox);
but it gives me an error and does not compile it (2 line) . It says "Cannot convert from System.Windows.Forms.RichTextBox to System.Web.UI.Control...
Is there another way to display the component on the web..
Thank you.
Sorry for the confusion.
I assumed that you were doing a WinForms application because this is the forum specifically for Winforms stuff. Thats why I suggest the RishTextBox.
You'll have to ignore the RichTextBox. Trying to use System.Windows.Forms in your web app is the wrong thing to do.
Try posting your question on one of the asp.net forums. you will get a better response there.
Regards