I’m trying the get the inputted values from the user and save it on a char variable, but the problem is that nothing occurs, and I think the problem is with the Form Focus, this is the code, and when I run it no errors occurs, but also nothing happen. What I did wrong?
char keyPressed;
public FrmZigndSC()
{
InitializeComponent();
this.Focus();
}
private void FrmZigndSC_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
keyPressed = e.KeyChar;
LblResult.Text += Convert.ToString(keyPressed);
}
You can try with this code – Based on
KeyPressEventHandler