List<string> GSCarNo = new List<string>();
//添加一空白选项
GSCarNo.Add("");
tag=false
private void com_vehicle_code_KeyUp(object sender, KeyEventArgs e)
{
//回车模糊查询
if (e.KeyCode == Keys.Enter)
{
if (com_vehicle_code.Text.Trim().Length != 0)
{
if (radioCol.Checked)
{
List<string> subGSCarNo = GSCarNo.FindAll(GSMatchCarNo);
com_vehicle_code.DataSource = subGSCarNo;
if (com_vehicle_code.DroppedDown)
{
com_vehicle_code.DroppedDown = false;
}
else
{
com_vehicle_code.DroppedDown = true;
}
}
else if (radioHe.Checked)
{
List<string> subWGCarNo = WGCarNo.FindAll(GSMatchCarNo);
com_vehicle_code.DataSource = subWGCarNo;
if (com_vehicle_code.DroppedDown)
{
com_vehicle_code.DroppedDown = false;
}
else
{
com_vehicle_code.DroppedDown = true;
}
}
}
}
}
private bool GSMatchCarNo(string s)
{
if (s.IndexOf(com_vehicle_code.Text.Trim()) > -1)
{
return true;
}
return false;
}
if (com_vehicle_code.Text.Trim().Length == 0)
{
if (radioCol.Checked)
{
com_vehicle_code.DataSource = GSCarNo;
}
else if (radioHe.Checked)
{
com_vehicle_code.DataSource = WGCarNo;
}
}
private void com_vehicle_code_DropDownClosed(object sender, EventArgs e)
{
com_vehicle_code.Tag = "false";
}
if (radioHe.Checked)
{
DataRow[] drs = _dtcar.Select("vi_vehicle_code='" + com_vehicle_code.Text.Trim() + "'");
if (drs.Length > 0)
{
com_driver.Text = drs[0]["vi_driver_name"].ToString();
com_driver_phone.Text = drs[0]["vi_driver_mobile"].ToString();
}
}
private void com_vehicle_code_SelectedIndexChanged(object sender, EventArgs e)
{
if (radioHe.Checked)
{
DataRow[] drs = _dtcar.Select("vi_vehicle_code='" + com_vehicle_code.Text.Trim() + "'");
if (drs.Length > 0)
{
com_driver.Text = drs[0]["vi_driver_name"].ToString();
com_driver_phone.Text = drs[0]["vi_driver_mobile"].ToString();
}
}
}