RichTextBox - AutoWordSelection??? no effect
-
I'm baffled here. My user has a simple request, when he tabs from one control to the next, he wants to have the RichTextBoxes automatically select the entire word so he can start typing a new value (as opposed to having to stop and grab his mouse...or repeatedly hit the delete key to erase the current text in the control) So I look up and change the RichTextBox AutoWordSelect property from false to true. According to MSDN this should do the trick right? Ummm....wrong. As far as I can tell this property has no effect whatsoever. I've also tried changing various other properties onmy RichText box in case there's some interaction, Multi-line, HideSelection, ShowSelectionMargin etc. etc. in case there's some bizarre undocumented interaction going on, but nothing I've tried so far results in a RichTextBox that behaves the way it should. To me this is doubly irritating, because after all, the behavior he's asking me for is pretty much the default normal behavior for any type of form (just tab around on any web page with user login/password text boxes and you'll see what I mean). Perhaps this is a .NET question, I'm sure there's overlap. I've google searched this one and I'm not the only one who's seen it and asked about it, but I haven't found any legit replies and solutions to anyones question. FYI I'm using VS2003/Csharp for the project. Thanks in advance for advice/help. This extremely simple request has me pulling my hair out in frustration.
-
I'm baffled here. My user has a simple request, when he tabs from one control to the next, he wants to have the RichTextBoxes automatically select the entire word so he can start typing a new value (as opposed to having to stop and grab his mouse...or repeatedly hit the delete key to erase the current text in the control) So I look up and change the RichTextBox AutoWordSelect property from false to true. According to MSDN this should do the trick right? Ummm....wrong. As far as I can tell this property has no effect whatsoever. I've also tried changing various other properties onmy RichText box in case there's some interaction, Multi-line, HideSelection, ShowSelectionMargin etc. etc. in case there's some bizarre undocumented interaction going on, but nothing I've tried so far results in a RichTextBox that behaves the way it should. To me this is doubly irritating, because after all, the behavior he's asking me for is pretty much the default normal behavior for any type of form (just tab around on any web page with user login/password text boxes and you'll see what I mean). Perhaps this is a .NET question, I'm sure there's overlap. I've google searched this one and I'm not the only one who's seen it and asked about it, but I haven't found any legit replies and solutions to anyones question. FYI I'm using VS2003/Csharp for the project. Thanks in advance for advice/help. This extremely simple request has me pulling my hair out in frustration.
You mean select the entire text or just the last word? Have you tried
Select(0, TextLength)
? -
You mean select the entire text or just the last word? Have you tried
Select(0, TextLength)
?No no no. I want the FORM to automatically select the text when the control receives focus. I probably can select text from inside my program with a statement, but that's not the point. Plus...I have over 20 RichTextBox controls on this form and I want them ALL to behave the same way. If I have to go through and add all kinds of OnReceiveFocus() Handlers and Select(0, TextLength); statements then I'll be here all day. My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it? Phil
-
No no no. I want the FORM to automatically select the text when the control receives focus. I probably can select text from inside my program with a statement, but that's not the point. Plus...I have over 20 RichTextBox controls on this form and I want them ALL to behave the same way. If I have to go through and add all kinds of OnReceiveFocus() Handlers and Select(0, TextLength); statements then I'll be here all day. My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it? Phil
Phil C wrote:
My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it?
I think you understand it incorrectly. You actually need to select part of the word to select the whole one. Recheck the documentation.
-
Phil C wrote:
My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it?
I think you understand it incorrectly. You actually need to select part of the word to select the whole one. Recheck the documentation.
Hmmm, well you are right, I guess I did misread what ths property was for. However, setting this property to true still has no effect. I have two controls on a form side by side. One with autoword select = true and one with autoselect=false. As far as I can tell both controls behave the exact same way. I can select a single letter, a couple letters, or the entire word with my mouse. But as usual I'm getting distracted from the goal I was tyring to achieve which was selecting the text as soon as the control gain focus. It's just frustrating when you try and experiment and various properties seem to have no effect. About the only thing I can conclude is perhaps if the RichTextBox is stretched out and contains a sentence rather than a single word it works. I don't know *sigh*