All I was wondering if someone could point me to a simple step-by-step C# example of accessing selected text within a richTextBox... The functionality I'm looking for is ultimately the kind you get with a toolbar shortcut (ie: bold selected text) but I'm so new to .Net, I can't figure out how to reference a selection of text within the richTextBox. Any help on this matter would be greatly appreciated. Thanks in advance. - CES
On Jul 22, 9:41 am, "none" wrote: > All > I was wondering if someone could point me to a simple step-by-step C# > example of accessing selected text within a richTextBox... The functionality > I'm looking for is ultimately the kind you get with a toolbar shortcut (ie: > bold selected text) but I'm so new to .Net, I can't figure out how to > reference a selection of text within the richTextBox. > Any help on this matter would be greatly appreciated. Thanks in advance. - > CES > > QMARK.GIF > 1KViewDownload > > ARROW.GIF > 1KViewDownload Take a look at the Selected property of the RichTextBox control
"none" skrev i meddelandet news:eaJIxCA7IHA.2260@TK2MSFTNGP03.phx.gbl... > All > I was wondering if someone could point me to a simple step-by-step C# > example of accessing selected text within a richTextBox... The > functionality > I'm looking for is ultimately the kind you get with a toolbar shortcut > (ie: > bold selected text) but I'm so new to .Net, I can't figure out how to > reference a selection of text within the richTextBox. > Any help on this matter would be greatly appreciated. Thanks in > advance. - > CES > Use richtextbox selection properties. Like richTextBox.SelectedText or SelectedRtf if you would like to keep the rtf formatting, SelectionColor, SelectionBackColor, SelectionFont and so on. e.g. string str = richtextBox1.SelectedText;
I have tried the Selected Method but it seams that the textbox is losing focus win I click the button... "none" wrote in message news:eaJIxCA7IHA.2260@TK2MSFTNGP03.phx.gbl... > All > I was wondering if someone could point me to a simple step-by-step C# > example of accessing selected text within a richTextBox... The > functionality > I'm looking for is ultimately the kind you get with a toolbar shortcut > (ie: > bold selected text) but I'm so new to .Net, I can't figure out how to > reference a selection of text within the richTextBox. > Any help on this matter would be greatly appreciated. Thanks in > advance. - > CES > > > > > >
Sorry my bad I was setting the text property to an empty string... thanks for the help - CES "none" wrote in message news:eaJIxCA7IHA.2260@TK2MSFTNGP03.phx.gbl... > All > I was wondering if someone could point me to a simple step-by-step C# > example of accessing selected text within a richTextBox... The > functionality > I'm looking for is ultimately the kind you get with a toolbar shortcut > (ie: > bold selected text) but I'm so new to .Net, I can't figure out how to > reference a selection of text within the richTextBox. > Any help on this matter would be greatly appreciated. Thanks in > advance. - > CES > > > > > >
All, I'm trained to figure out a simple example of connecting to a database. unfortunately I'm running into problems. I'm using Access 2007 as my back end database (because I'm familiar with Access and don't want to add the complexity of a SQL database that I have never worked with before) while I'm learning C#. I have a memo field in an Access Table that accepts RTF Formatted text (this field works perfectly in Access). When I past the text into the field on my form, the text looks as it should, for test purposes I'm using C# code, in the example below private & null would be blue and IContainer would be light Blue: private System.ComponentModel.IContainer components = null; ... however when I navigate away from the row all font information is lost? If anyone has any suggestions would be greatly appreciated. Thanks in advance. - CES
I haven't played with this but just a thought, I remember reading this is stored as HTML. I remember, http://allenbrowne.com/Access2007.html again this might be a hint. "CES" wrote in message news:u%23ilTzD7IHA.4204@TK2MSFTNGP03.phx.gbl... > All, > I'm trained to figure out a simple example of connecting to a database. > unfortunately I'm running into problems. I'm using Access 2007 as my back > end database (because I'm familiar with Access and don't want to add the > complexity of a SQL database that I have never worked with before) while > I'm > learning C#. > > I have a memo field in an Access Table that accepts RTF Formatted text > (this > field works perfectly in Access). When I past the text into the field on > my > form, the text looks as it should, for test purposes I'm using C# code, in > the example below private & null would be blue and IContainer would be > light > Blue: > > private System.ComponentModel.IContainer components = null; > > > ... however when I navigate away from the row all font information is > lost? > If anyone has any suggestions would be greatly appreciated. Thanks in > advance. - CES >