private void ManagePlayerPositionsForm_Load(object sender, EventArgs e) { // Load player positions from settings PlayerPositionCollection playerPositions = Properties.Settings.Default.PlayerPositions; if (playerPositions != null) { foreach (PlayerPosition playerPosition in playerPositions.PlayerPositions) { playerPositionBindingSource.Add(playerPosition); } } }
private void ManagePlayerPositionsForm_FormClosed(object sender, FormClosedEventArgs e) { // Save player positions to settings PlayerPositionCollection playerPositions = new PlayerPositionCollection(); foreach (DataGridViewRow row in dataGridViewPlayerPositions.Rows) { if (row.DataBoundItem != null) { playerPositions.PlayerPositions.Add((PlayerPosition)row.DataBoundItem); } } Properties.Settings.Default.PlayerPositions = playerPositions; Properties.Settings.Default.Save(); }