#region 初始化设备信息
/// <summary>
/// 初始化设备信息
/// </summary>
private void InitVMSDevice()
{
DataTable dt = timsControl.GetVMSDeviceInfo();
DataRow dr = dt.NewRow();
dr["glid"] = "-1";
dr["azdd"] = "请选择";
dt.Rows.InsertAt(dr, 0);
if (dt != null && dt.Rows.Count > 0)
{
this.cbxDevice.ValueMember = "glid";
this.cbxDevice.DisplayMember = "azdd";
this.cbxDevice.DataSource = dt;
this.cbxHistoryDevice.ValueMember = "glid";
this.cbxHistoryDevice.DisplayMember = "azdd";
this.cbxHistoryDevice.DataSource = dt;
}
string[] arr = new string[dt.Rows.Count];
for (int i = 0; i < arr.Length; i++)
{
arr[i] = dt.Rows[i][1].ToString();
}
cbxDevice.AutoCompleteCustomSource.AddRange(arr);
cbxDevice.AutoCompleteSource = AutoCompleteSource.CustomSource;
cbxDevice.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
cbxHistoryDevice.AutoCompleteCustomSource.AddRange(arr);
cbxHistoryDevice.AutoCompleteSource = AutoCompleteSource.CustomSource;
cbxHistoryDevice.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
}
#endregion
PS:只能从首字符开始模糊查找