示例#1
0
        private void ClearControl()
        {
            foreach (Control control in grpChanDoan.Controls)
            {
                if (control is EditBox)
                {
                    var txtControl = new EditBox();
                    txtControl = ((EditBox) control);
                    txtControl.Clear();
                }
                if (control is CalendarCombo)
                {
                    var txtControl = new CalendarCombo();
                    txtControl = ((CalendarCombo) control);
                    txtControl.NullValue = true;
                }

                if (control is UICheckBox)
                {
                    var txtControl = new UICheckBox();
                    txtControl = ((UICheckBox) control);
                    txtControl.Checked = false;
                }
                if (control is MaskedEditBox)
                {
                    var txtControl = new MaskedEditBox();
                    txtControl = ((MaskedEditBox) control);
                    txtControl.Clear();
                }
                if (control is RichTextBox)
                {
                    var txtControl = new RichTextBox();
                    txtControl = ((RichTextBox) control);
                    txtControl.Clear();
                }
            }
        }
        private void ClearControl()
        {
            txtNgaySinh.Clear();
            txtThangSinh.Clear();
            txtDienThoai.Clear();
            txtDanToc.Clear();
            txtMaLanKham.Clear();
            txtThongTinLienHe.Clear();
            txtChanDoanBanDau.Clear();
            txtNoiLamViec.Clear();

            foreach (Control control in KHAMBENH.Controls)
            {
                if (control is EditBox)
                {
                    var txtControl = new EditBox();
                    txtControl = ((EditBox) control);
                    txtControl.Clear();
                }
                if (control is CalendarCombo)
                {
                    var txtControl = new CalendarCombo();
                    txtControl = ((CalendarCombo) control);
                    txtControl.NullValue = true;
                }

                if (control is UICheckBox)
                {
                    var txtControl = new UICheckBox();
                    txtControl = ((UICheckBox) control);
                    txtControl.Checked = false;
                }
                if (control is MaskedEditBox)
                {
                    var txtControl = new MaskedEditBox();
                    txtControl = ((MaskedEditBox) control);
                    txtControl.Clear();
                }
                if (control is RichTextBox)
                {
                    var txtControl = new RichTextBox();
                    txtControl = ((RichTextBox)control);
                    txtControl.Clear();
                }

            }

            foreach (Control control in LDVV.Controls)
            {
                if (control is EditBox)
                {
                    var txtControl = new EditBox();
                    txtControl = ((EditBox) control);
                    txtControl.Clear();
                }
                if (control is CalendarCombo)
                {
                    var txtControl = new CalendarCombo();
                    txtControl = ((CalendarCombo) control);
                    txtControl.NullValue = true;
                }

                if (control is UICheckBox)
                {
                    var txtControl = new UICheckBox();
                    txtControl = ((UICheckBox) control);
                    txtControl.Checked = false;
                }
                if (control is MaskedEditBox)
                {
                    var txtControl = new MaskedEditBox();
                    txtControl = ((MaskedEditBox) control);
                    txtControl.Clear();
                }
                if (control is RichTextBox)
                {
                    var txtControl = new RichTextBox();
                    txtControl = ((RichTextBox)control);
                    txtControl.Clear();
                }

            }
            foreach (Control control in HOIBENH.Controls)
            {
                if (control is EditBox)
                {
                    var txtControl = new EditBox();
                    txtControl = ((EditBox) control);
                    txtControl.Clear();
                }
                if (control is CalendarCombo)
                {
                    var txtControl = new CalendarCombo();
                    txtControl = ((CalendarCombo) control);
                    txtControl.NullValue = true;
                }

                if (control is UICheckBox)
                {
                    var txtControl = new UICheckBox();
                    txtControl = ((UICheckBox) control);
                    txtControl.Checked = false;
                }
                if (control is MaskedEditBox)
                {
                    var txtControl = new MaskedEditBox();
                    txtControl = ((MaskedEditBox) control);
                    txtControl.Clear();
                }
                if (control is RichTextBox)
                {
                    var txtControl = new RichTextBox();
                    txtControl = ((RichTextBox)control);
                    txtControl.Clear();
                }

            }
        }
        private void ClearControlOfUc(Control parent)
        {
            try
            {
                foreach (Control control in parent.Controls)
                {
                    if (control is EditBox)
                    {
                        var txtControl = new EditBox();
                        txtControl = ((EditBox)control);
                        txtControl.Clear();
                    }
                    if (control is CalendarCombo)
                    {
                        var txtControl = new CalendarCombo();
                        txtControl = ((CalendarCombo)control);
                        txtControl.NullValue = true;
                    }

                    if (control is UICheckBox)
                    {
                        var txtControl = new UICheckBox();
                        txtControl = ((UICheckBox)control);
                        txtControl.Checked = false;
                    }
                    if (control is MaskedEditBox)
                    {
                        var txtControl = new MaskedEditBox();
                        txtControl = ((MaskedEditBox)control);
                        txtControl.Clear();
                    }
                    if (control is RichTextBox)
                    {
                        var txtControl = new RichTextBox();
                        txtControl = ((RichTextBox)control);
                        txtControl.Clear();
                    }

                }
            }
            catch (Exception ex)
            {

                Utility.CatchException(ex);
            }
        }