コード例 #1
0
        private void cboSearch_TextChanged(object sender, EventArgs e)
        {
            int i = 0;

            if (cboSearch.Text == "")
            {
                HienThiPhieuNhap();
                return;
            }
            pn.Search = cboSearch.Text;
            List <PhieuNhapHang> pnlist = pnbll.TimKiemPhieuNhap(pn);

            dgvPhieuNhap.Rows.Clear();

            foreach (PhieuNhapHang pns in pnlist)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(dgvPhieuNhap);

                row.Cells[0].Value = i + 1;
                row.Cells[1].Value = pns.MaPn;
                row.Cells[2].Value = pns.MaNv;
                row.Cells[3].Value = pns.MaDh;
                row.Cells[4].Value = pns.NgayNhap;
                row.Cells[5].Value = pns.MaSp;
                row.Cells[6].Value = pns.Sln;
                row.Cells[7].Value = pns.DonGias;

                dgvPhieuNhap.Rows.Add(row);
                ++i;
            }
        }