using System.Windows.Forms;

namespace KeypressErrorGridView
{
    public partial class Form1 : Form
    {
        private int count_ = 0;
        private const string s = "KeyPressCount";
        public Form1()
        {
            InitializeComponent();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            count_++;

            radLabel2.Text = string.Format("{0}: {1}", s, count_);

            radListView1.BeginUpdate();
            if (count_ % 10 == 0)
            {
                radListView1.Items.Clear();
            }
            else
            {
                radListView1.Items.Add(count_);
            }
            radListView1.EndUpdate();

            radGridView1.BeginUpdate();
            if (count_ % 10 == 0)
            {
                radGridView1.Rows.Clear();
            }
            else
            {
                radGridView1.Rows.AddNew();
                radGridView1.Rows[radGridView1.Rows.Count - 1].Cells[0].Value = count_;
            }
            radGridView1.EndUpdate();

            return base.ProcessCmdKey(ref msg, keyData);
        }
    }
}
