Esempio n. 1
0
        void OnGridEditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            DataGridViewCell current = _grid.CurrentCell;
            Rule             rule    = _rules.GetRule(current.ColumnIndex, current.RowIndex);

            if (null == rule)
            {
                if (null != _validator)
                {
                    if (_validator.IsEventsAttached)
                    {
                        _validator.EventsDetach();
                        EventsDetach();
                    }
                }

                return;
            }



            _textBox = e.Control as TextBox;

            if (null == _validator)
            {
                _validator = new MtTextBoxValidator(_textBox, rule.ValidatorData);
                EventsAttach();
            }
            else
            {
                _validator.ValidatorData = (MtTextBoxValidator.Data)rule.ValidatorData.Clone();

                if (!_validator.IsEventsAttached)
                {
                    _validator.EventsAttach();
                    EventsAttach();
                }
            }
        }
Esempio n. 2
0
 public MtValidatedTextBox()
 {
     _validator = new MtTextBoxValidator(this);
 }