A more elegant solution would be:
Vector2 movement = Vector2.Zero;
if (input.IsKeyDown(Keys.Up))
movement.Y -= 1;
if (input.IsKeyDown(Keys.Down))
movement.Y += 1;
if (input.IsKeyDown(Keys.Left))
movement.X -= 1;
if (input.IsKeyDown(Keys.Right))
movement.X += 1;
if (movement != Vector2.Zero && !(movement.X != 0 && movement.Y != 0))
{
gplayer.direction = movement.X + 2*movement.Y + 2; // feel free to change this, this is just one possible way to make an integer direction.
playerSprite += 4 * movement;
}
for the grid, you want to store the player's position in terms of the grid, (like pos = tile (3,4)), and then make the grid length a constant. For movement, pick a move speed that will evenly go into the grid length, and then add it to the player's real position each frame until it matches the grid position.
Math.Floor(real position / grid length) = grid position
(you only need Math.Floor if either real position or grid length is NOT an int.