protected void SetText(bool strict) { if (SetClass == null || SetClass.SortProperty == null || SetClass.SortProperty.PropertyType != typeof(string)) { txtMain.ForeColor = Color.Brown; if (Value != null) { bool ved = ValueEventDisabled; string txt = txtMain.Text; ValueEventDisabled = true; Value = null; txtMain.Text = txt; ValueEventDisabled = ved; SendKeys.Send("{RIGHT}"); } } else { string find = txtMain.Text; position = SetClass.FindIndex(find, strict); if (position < 0) { txtMain.ForeColor = Color.Brown; Value = null; } else { txtMain.ForeColor = Color.Black; ValueEventDisabled = true; Value = (BaseDat)SetClass[position]; txtMain.Text = SetClass.SortProperty.GetValue(Value).ToString(); int i = txtMain.Text.ToLower().IndexOf(find.ToLower()) + find.Length; txtMain.Select(i, txtMain.Text.Length - i); ValueEventDisabled = false; } } }