c# - Avoid that a word be deselected -


i'm working in application going measure speed of typing.

i want select word writing @ moment. have fragment of code in form load event:

string line;  filestream fs = new filestream("text.txt", filemode.open, fileaccess.read); streamreader fr = new streamreader(fs);  while ((line = fr.readline()) != null) {     textbox1.appendtext(line); }  string texto = textbox1.text;  string[] split = texto.split(new char[] { ' ' }); textbox1.selectionstart = 0; textbox1.selectionlength = split[0].length; 

that works correctly, when change focus textbox begin type, selected word disappears.

is there way avoid happening ?

to prevent textbox losing selection when loses focus, can (when form created).

textbox1.hideselection = false; 

refer textboxbase.hideselection property:

gets or sets value indicating whether selected text in text box control remains highlighted when control loses focus.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -