Zanima me zasto ova tu forma reagira samo na event klikanja na gumb "Cancel" a ovaj event pritiska na neku tipku na tipkovnici kao da ignorira.Kad izbrisem gumb "Cancel" i sve vezano uz njega normalno radi event pritiska na keyboard al kad su zajedno ne zele radit,a sve se ok kompajlira..
Ako neko zna puno mu hvala..

Pozdrav
Code:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Project1
{
class Forma : Form
{
private Button gumb;
public Forma()
{
this.gumb = new Button();
gumb.Location = new Point(100, 12);
gumb.Text = "Cancel";
this.KeyUp += new KeyEventHandler(this.PritisakTipke);
gumb.Click += new EventHandler(this.CancelGumb);
this.Controls.Add(gumb);
}
protected void PritisakTipke(object sender, KeyEventArgs e)
{
MessageBox.Show(e.KeyCode.ToString());
}
protected void CancelGumb(object sender, EventArgs e)
{
MessageBox.Show("Stisnuo si cancel!");
}
static void Main()
{
Application.Run(new Forma());
}
}
}
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Project1
{
class Forma : Form
{
private Button gumb;
public Forma()
{
this.gumb = new Button();
gumb.Location = new Point(100, 12);
gumb.Text = "Cancel";
this.KeyUp += new KeyEventHandler(this.PritisakTipke);
gumb.Click += new EventHandler(this.CancelGumb);
this.Controls.Add(gumb);
}
protected void PritisakTipke(object sender, KeyEventArgs e)
{
MessageBox.Show(e.KeyCode.ToString());
}
protected void CancelGumb(object sender, EventArgs e)
{
MessageBox.Show("Stisnuo si cancel!");
}
static void Main()
{
Application.Run(new Forma());
}
}
}