private void CreditorFind_KeyUp(object sender, KeyEventArgs e) { string str = e.KeyCode.ToString(); if (str == "Down") { CreditorList.Focus(); CreditorFind.Text = CreditorList.Text; } else if (str == "Up") { CreditorList.Focus(); CreditorFind.Text = CreditorList.Text; } if (str == "Return") { CreditorList.SelectedIndex = CreditorList.FindString(CreditorFind.Text, 0); str = CreditorList.SelectedValue.ToString(); string glid = str.Substring(0, str.IndexOf("-")); string slid = str.Substring(str.IndexOf("-") + 1, str.Length - (str.IndexOf("-") + 1)); label8.Text = glid; label9.Text = slid; CreditorFind.Text = CreditorList.Text; CreditorList.Visible = false; TxtInv.Focus(); } }
private void CreditorFind_TextChanged(object sender, EventArgs e) { string str = CreditorFind.Text; try { CreditorList.SelectedIndex = CreditorList.FindString(str, 0); } catch (Exception ex) { MessageBox.Show(ex.Message); } }