private void AddLocationButton_Click(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(AddLocationNameBox.Text)) { MessageBox.Show("Location name must not be empty!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Location location = _secSystem.CreateLocation(AddLocationNameBox.Text); if (location == null) { MessageBox.Show("Error with creating location! Check data base connection.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } UpdateLocationsList(); }