コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //if (textBox1.Text == "")
            //{
            //    BindingSource source = new BindingSource();
            //    source.DataSource = DeTaiController.getListDT();
            //    this.dataGridView1.DataSource = source;
            //}
            //else
            //{


            if (this.cboTimKiem.SelectedIndex == 0)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListMaDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }
            if (this.cboTimKiem.SelectedIndex == 1)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListTenDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }
            if (this.cboTimKiem.SelectedIndex == 2)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListLoaiDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }
            if (this.cboTimKiem.SelectedIndex == 3)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListNhomDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }
            if (this.cboTimKiem.SelectedIndex == 4)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListGiaoVienDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }
            if (this.cboTimKiem.SelectedIndex == 5)
            {
                BindingSource source = new BindingSource();
                source.DataSource             = TimKiemController.getListNoiDungDT(textBox1.Text);
                this.dataGridView1.DataSource = source;
            }

            // }
        }
コード例 #2
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     if (this.cboTimKiem.SelectedIndex == 0)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListMaDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
     if (this.cboTimKiem.SelectedIndex == 1)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListTenDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
     if (this.cboTimKiem.SelectedIndex == 2)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListLoaiDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
     if (this.cboTimKiem.SelectedIndex == 3)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListNhomDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
     if (this.cboTimKiem.SelectedIndex == 4)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListGiaoVienDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
     if (this.cboTimKiem.SelectedIndex == 5)
     {
         BindingSource source = new BindingSource();
         source.DataSource             = TimKiemController.getListNoiDungDT(textBox1.Text);
         this.dataGridView1.DataSource = source;
     }
 }