I'm trying to make a picture move whenever I press "a". I'm using this function:
void Form1_KeyPress(object sender, KeyPressEventArgs e) { if(e.KeyChar == 65) { peanut.Location = new System.Drawing.Point(0, 0); } } Above the function it says 0 references if that helps. Also "peanut" is the name of the picture box.
When using peanut.Location = new System.Drawing.Point(0, 0); when the form loads, it works. I think the problem has to do with getting the key input, not how I'm moving the picture.
I tried using the KeyPress function, but for some reason it isn't working. This might be because e.KeyChar 65 isn't A, but if it isn't, could somebody show me a list of all the values and keys associated with them?