次のコードのComboBoxがあります。
private void comboBox1_TextChanged(object sender, EventArgs e)
{
using (var service = WebServiceHelper.GetCoreService())
{
string physicianXml = service.SearchPhysicians(SessionInfo.Current.ClientCode, SessionInfo.Current.MachineName,
SessionInfo.Current.Username, comboBox1.Text);
var physicians = PhysicianItemList.FromXml(physicianXml);
AutoCompleteStringCollection autoCompleteStringCollection = new AutoCompleteStringCollection();
foreach (var physician in physicians.Items)
{
autoCompleteStringCollection.Add(physician.LastName + ", " + physician.FirstName);
}
comboBox1.AutoCompleteCustomSource = autoCompleteStringCollection;
comboBox1.Select(comboBox1.Text.Length, 0);
}
}
基本的に、ユーザーは医師の名前の最初の数文字を入力し、オートコンプリートリストに一致する上位100件のレコードを入力する必要があります。これはうまく機能しますが、キー(テーブルのPKまたは医師のNPI番号)に関連付ける必要があります。AutoCompleteStringCollection
キーをサポートしていないようです。誰かがこれを行う方法を提案できますか?テーブルには約700万のレコードがあるため、ComboBoxに事前入力したくありません。
ありがとう