private void DoAutocomplete(AutoCompleteItem item, Range fragment) { string newText = item.GetTextForReplace(); //replace text of fragment var tb = fragment.tb; tb.Selection.Start = fragment.Start; tb.Selection.End = fragment.End; tb.InsertText(newText); tb.Focus(); }