public void FormCustomerManager_Load(object sender, EventArgs e)
 {
     //DataTable dt = db.GetAllCustomer();
     //dataGridView1.DataSource = dt;
     //dataGridView1.ClearSelection();//清除选中状态
     mySource.DataSource = db.GetAllCustomer();
 }
        public void FormCustomerSearch_Load(object sender, EventArgs e)
        {
            DataBaseOperationDLL db = new DataBaseOperationDLL();
            DataTable            dt = db.GetAllCustomer();

            dataGridView1.DataSource = dt;
            List <string> list = new List <string>();

            foreach (DataRow dr in dt.Rows)
            {
                if (dr["company"].ToString().Length != 0)
                {
                    list.Add(dr["company"].ToString());
                }
                if (dr["customer_name"].ToString().Length != 0)
                {
                    list.Add(dr["customer_name"].ToString());
                }
                if (dr["phone_number"].ToString().Length != 0)
                {
                    list.Add(dr["phone_number"].ToString());
                }
            }
            AutoCompleteStringCollection source = new AutoCompleteStringCollection();

            source.AddRange(list.ToArray());
            tbCustomer.AutoCompleteCustomSource = source;
            tbCustomer.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            tbCustomer.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            dataGridView1.ClearSelection();//清除选中状态
        }