コード例 #1
0
        private void txtTimKiem_KeyUp(object sender, KeyEventArgs e)
        {
            if (txtTimKiem.Text == "")
            {
                hienThiPhieuXuat(CPhieuXuatNguyenLieu_BUS.toList());
                return;
            }

            // nếu combox tìm kiếm là 0 tức là tìm theo mã phiếu nhập
            if (cmbTimKiem.SelectedIndex == 0)
            {
                hienThiPhieuXuat(CPhieuXuatNguyenLieu_BUS.toListMa(txtTimKiem.Text));
            }
            else
            {
                try
                {
                    double tongThanhTien = double.Parse(txtTimKiem.Text);
                    hienThiPhieuXuat(CPhieuXuatNguyenLieu_BUS.toListTongThanhTien(tongThanhTien));
                }
                catch (ArgumentNullException)
                {
                    MessageBox.Show("Dữ liệu không được để rỗng");
                }
                catch (FormatException)
                {
                    MessageBox.Show("Dữ liệu phải là số");
                }
                catch (OverflowException)
                {
                    MessageBox.Show("Dữ liệu có độ lớn vượt quá giới hạn cho phép");
                }
            }
        }