I am learning c# (finally) and am using VC# 2010 Express. Why do I have to manually declare events for them to trigger?? I have created my own form that I want to use as a Splash screen (see code below).
I have a breakpoint at both the mousedown and keydown events. When I press a key they key event will not trigger, however if I mousedown it will (after I added the eventhandler part). Is this inherent to c# or the express version of 2010 or what??Code:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LotusAnalyzer { public partial class frmSplash : Form { public frmSplash() { InitializeComponent(); this.MouseDown += new MouseEventHandler(frmSplash_MouseDown); } private void frmSplash_Load(object sender, EventArgs e) { } private void frmSplash_KeyDown(object sender, KeyEventArgs e) { switch(e.ToString()) { case "enter": this.Close(); break; } } private void frmSplash_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.Close(); } } } }
Thanks in advance!!
D




Reply With Quote
