Sam

Sam

  • NA
  • 166
  • 0

Extract information from inside a private event handler

Sep 12 2009 2:18 PM

Hello all,
Need some help in my first Win Form application.
A key click event handler works fine internally as a private method.
Unfortunately I don't know how I can extract the information out of the private event handler.
I need the 'keynum' paramater outside the method.
A return parameter is not accepted in the event handler (The relevant hidden delegate is set void?)
The error is: byte WindowsFormsApplication4.Form1.Key_Click(object, System.EventArgs)' has the wrong return type 
Sam
 
private
void Key_Click(object sender, EventArgs e)
{
Button currentkey = (Button)sender;
//remove the word 'Key' from the name like from 'Key05'
string currentKey = currentkey.Name.Remove(0, 3);
byte keynum = Convert.ToByte(currentKey);
textBox1.Text =
Convert.ToString(keynum);

}

Answers (4)