Hi guys and sorry if this is the wrong forum. I am messing around with visual studio and trying to make a picturebox move around on a form when a user clicks a directional button on the form. I am able to move the picturebox any direction I want by doing something like this:
private void downBut_Click(object sender, EventArgs e)
{
Point p = moveBox.Location;
p.Y += 20;
moveBox.Location = p;
}
However, I would like to put the meat of the method into another class called movementClass and handle movement that way. For example:
private void leftBut_Click(object sender, EventArgs e)
{
movementClass MC = new movementClass();
MC.moveLeft();
}
Would call:
class movementClass:Form1
{
public void moveLeft()
{
Point p = moveBox.Location;
p.X -= 20;
moveBox.Location = p;
}
I don't get any errors right now when running the program, but nothing happens when I click the button to move the picturebox to the left. Can someone point me in the right direction?