コード例 #1
0
        public static int GetErrorCount(this ErrorProvider ep)
        {
            var controls = ep.GetOrSetAttached(() => new HashSet <Control>()).Value;

            var errControls = from c in controls
                              let err = ep.GetError(c)
                                        let hasErr = !string.IsNullOrEmpty(err)
                                                     where hasErr
                                                     select c;

            var errCount = errControls.Count();

            return(errCount);
        }
コード例 #2
0
        public static void TrackControl(this ErrorProvider ep, Control c)
        {
            var controls = ep.GetOrSetAttached(() => new HashSet <Control>()).Value;

            controls.Add(c);
        }