// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Drawing; using System.Windows.Forms; namespace E { public class MainForm : Form { private TextBox textBox1; public MainForm() { InitializeComponent(); } [STAThread] public static void Main(string[] args) { Application.Run(new MainForm()); } private void InitializeComponent() { textBox1 = new TextBox(); SuspendLayout(); textBox1.Location = new Point(25, 25); textBox1.Multiline = true; textBox1.Size = new Size(150, 150); textBox1.Text = ""; textBox1.KeyDown += new KeyEventHandler(TextBox1KeyDown); ClientSize = new Size(200, 200); Controls.Add(textBox1); Text = "Test"; ResumeLayout(false); } void TextBox1KeyDown(object sender, KeyEventArgs e) { if(e.KeyCode == Keys.A && e.Shift) { MessageBox.Show("stort A"); } else if(e.KeyCode == Keys.A && !e.Shift) { MessageBox.Show("lille a"); } } } }