can anyone help me...............
in the attachment i've made textfield and a button.........in that on pressing "A" the count begins which is been displayed in the label..........but the speed of the counting is very fast when pressed down without releasing......can anyone tell me how to reduce the speed of the count.........i want an average speed but not like that of clock second speed but rather a little more.............

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace MultipleKeys
{
    public partial class MainForm : Form
    {

        int s = 0;
        public MainForm()
        {
            InitializeComponent();
            
            keyMonitor.Start();
        }
        
        private List<Keys> keys = new List<Keys>();
        
        private void MainFormKeyDown(object sender, KeyEventArgs e)
        {
            if(!keys.Contains(e.KeyCode))
            {
                keys.Add(e.KeyCode);
            }
            if (e.KeyCode == Keys.A)
            {
                SetCount();
            }
            
        }
        public void SetCount()
        {
            s++;
            label1.Text = ""+ s;
        }

        private void MainFormKeyUp(object sender, KeyEventArgs e)
        {
            keys.Remove(e.KeyCode);
        }
                
        private void KeyMonitorTick(object sender, EventArgs e)
        {
            Invoke((Action)SetPanelColors);
        }

        private void SetPanelColors()
        {
            SetPanelColor(centerLeftPanel, Keys.A);
        }
        
        private void SetPanelColor(Panel panel, Keys key)
        {
            panel.BackColor = keys.Contains(key)
                ? RandomColor()
                : Color.Black;
        }
        
        private Random random = new Random();
        
        private Color RandomColor()
        {
            return Color.FromArgb(
                128 + random.Next(128),
                128 + random.Next(128),
                128 + random.Next(128));
        }
    }
}

still not working properly..............if i put sleep 38 and s=100,it is printing somewat good, but that starts only from 10,11,12,....even though none of the sleep value gives a perfection in printing..........when i put 500 it is counting but that is not showing in the label during the counting...........

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
using System.Text;
using System.Threading;
using System.Runtime.InteropServices;
namespace MultipleKeys
{
    public partial class MainForm : Form
    {

        int s = 0;
        public MainForm()
        {
            InitializeComponent();
            
            keyMonitor.Start();
        }
        
        private List<Keys> keys = new List<Keys>();
        
        private void MainFormKeyDown(object sender, KeyEventArgs e)
        {
            if(!keys.Contains(e.KeyCode))
            {
                keys.Add(e.KeyCode);
            }
            if (e.KeyCode == Keys.A)
            {
                s++;
                SetCount(s);
            }
            
        }
        public void SetCount(int s)
        { 
                    
                    label1.Text = "" + s;
                    Thread.Sleep(500);
        }

        private void MainFormKeyUp(object sender, KeyEventArgs e)
        {
            keys.Remove(e.KeyCode);
        }
                
        private void KeyMonitorTick(object sender, EventArgs e)
        {
            Invoke((Action)SetPanelColors);
        }

        private void SetPanelColors()
        {
            SetPanelColor(centerLeftPanel, Keys.A);
        }
        
        private void SetPanelColor(Panel panel, Keys key)
        {
            panel.BackColor = keys.Contains(key)
                ? RandomColor()
                : Color.Black;
        }
        
        private Random random = new Random();
        
        private Color RandomColor()
        {
            return Color.FromArgb(
                128 + random.Next(128),
                128 + random.Next(128),
                128 + random.Next(128));
        }
    }
}

That's because you are running everything in the GUI thread, and you don't give it time to update. Put lable1.Refresh(); between lines 40 and 41 in your code.

FOR ALL OF YOU (Momerath, Mitja Bonca) THANKS A LOOOOOOOOOTTTTTTTTTTTTTTTT................

This question has already been answered. Start a new discussion instead.