I'm capturing keys on my WinForm but I'm trying to see if the pressed key is a 'String' - getting an
- by Sergio Tapia
Here's my code:
void gkh_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == neededLetter as Keys)
{
if (neededLetter == "n")
{
neededLetter = "o";
}
else if (neededLetter == "o")
{
neededLetter = "t";
}
else if (neededLetter == "t")
{
neededLetter = "e";
}
else if (neededLetter == "e")
{
this.Show();
}
}
else
{
neededLetter = "n";
}
}
I'm getting an error on the first If block:
The as operator must be used with a
reference type or nullable type