Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

builds, won't run

$
0
0

as a student, i'm using deitel's 'C# 2010 for programmers' on windows 7, 64 bit. the problem is the last 2 projects I've done I get 'KeyDemo.KeyDemo does not contain a definition for KeyDemo_Load' error message. If I add the load method, it compiles fine but I just get a blank form with no inter-action. there are no further error messages generated. the code:

using System;
using System.Windows.Forms;

namespace KeyDemo
{
   public partial class KeyDemo : Form
   {
      // default constructor
      public KeyDemo()
      {
         InitializeComponent();
      } // end constructor

      private void KeyDemo_Load(object sender, EventArgs e)
      {

      }

      // display the character pressed when using charKey
      private void KeyDemo_Press(object sender, KeyPressEventArgs e)
      {
         charLabel.Text = "Key Pressed: " + e.KeyChar;
      }
      // end method KeyDemo_KeyPress

      // display modifier keys, key code, key data, and key value
      private void KeyDemo_Down(object sender, KeyEventArgs e)
      {
         keyInfoLabel.Text =
            "Alt: " + (e.Alt ? "Yes" : "No ") + '\n' +"Shift: " + (e.Shift ? " Yes " : " No ") + '\n' +"Ctrl: " + (e.Control ? " Yes " : " No ") + 'n' +"KeyCode: " + e.KeyCode + '\n' +"KeyData: " + e.KeyData + '\n' +"KeyValue: " + e.KeyValue;
      } // end method KeyDemo_KeyDown

      // clear labels when key is released
      private void KeyDemo_KeyUp(object sender, KeyEventArgs e)
      {
         charLabel.Text = "";
         keyInfoLabel.Text = "";
      } // end method KeyDemo_KeyUp
   } // end class KeyDemo
} // end namespace Key Demo

thanks for any help


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>