Controlling markers by keyboard

When moving the markers by means of keyboard input, the marked marker is always moved. This is also selected on the interface.

The KeyDown event of the form is used to move the marker. This event is always triggered when a key is pressed. The value of the pressed key is located under the "KeyCode" parameter under the parameters of the type "KeyEventArgs". This value can be compared with the expected values. In this case the marker should be moved using the [D], [A], [W] and [S] keys.

The "Position" property is changed in order to shift the marker.

private void Form1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.KeyCode == Keys.D)
    {
        try
        {
            axisGroup.SubMember.OfType<MarkerContainer>().First().SubMember.OfType<Marker>().ToArray()[dataGridView1.SelectedCells[0].RowIndex].Position += 1;
        }
        catch (Exception)
        {
            MessageBox.Show("There is no X-Axis to move!");
        }
    }
    else if (e.KeyCode == Keys.A)
    {
        try
        {
            axisGroup.SubMember.OfType<MarkerContainer>().First().SubMember.OfType<Marker>().ToArray()[dataGridView1.SelectedCells[0].RowIndex].Position -= 1;
        }
        catch (Exception)
        {
            MessageBox.Show("There is no X-Axis to move!");
        }
    }
    else if (e.KeyCode == Keys.W)
    {
        try
        {
            axisGroup.SubMember.OfType<MarkerContainer>().First().SubMember.OfType<Marker>().ToArray()[dataGridView1.SelectedCells[0].RowIndex].Position += 0.1;
        }
        catch (Exception)
        {
            MessageBox.Show("There is no Y-Axis to move!");
        }
    }
    else if (e.KeyCode == Keys.S)
    {
        try
        {
            axisGroup.SubMember.OfType<MarkerContainer>().First().SubMember.OfType<Marker>().ToArray()[dataGridView1.SelectedCells[0].RowIndex].Position -= 0.1;
        }
        catch (Exception)
        {
            MessageBox.Show("There is no Y-Axis to move!");
        }
    }
}